Prevent subtrees from rerendering when their parent changes, or when certain context values change.
Part of React Hibernate
When a component's props, state, or context values change, it will rerender. This is fundamental to React and cannot be avoided.
This package includes components which will prevent those changes from reaching the component where possible.
Each receives a
shouldUpdate prop: when set to false, changes in outside values will be suppressed.
Prevents children from rerendering when the parent component updates. This is essentially just a typescript-friendly version of react-static-container
Freezes any React context, to prevent subscribed components in the subtree from updating when it changes.
Prevents subscribed components from rerendering when the redux state changes, or the return value from
dispatchWhenPaused prop controls the
canDispatch option of a Redux-Pauseable-Store.
How to use this
With React-Hibernate or React-Router-Hibernate, using one of these components -- or a new component composed from several of them together -- can prevent subtrees from updating while they're hibernating, to avoid needless work.
These can also be used on their own.
- The background screen behind a modal or dialog
- Inactive tabs or panes when using a wizard, accordion, or tabs widget.
- Freezing UI updates and interactions while performing reauthentication or other blocking tasks