2.0.0 • Published 3 years ago

react-controllable-update v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
3 years ago

React-ControllableUpdate

A small wrapper for component for React.memo that prevents component from being updated.

Usage

To use, simply import component and define if component should be updated via locked prop.

<ControllableUpdate locked={false}>{/* --- children --- */}</ControllableUpdate>

Component updates

Component will update if

  • locked prop is false
  • locked prop was true but then changed to false

Note: Just like with React.memo children components will be updated if they're updated within their state.

Why not just use React.memo?

Most of the times this would be good point but sometimes you might want advantages of this approach because:

  • If you want component memoized in just a single place, this will do.
  • If you do not want to pass all logic to props, this will do, you can calculate value of locked prop easily.
  • Allows just part/fragment of the component to be prevented from updating easily.

License

This project is licensed under the MIT License. Copy of license can be found in repository root.

2.0.0

3 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago