REACT-MAP-CONTEXT-TO-PROPS
What
Prevent unnecessary renders with ease!
Why
Managing your app state using context can cause a lot of unnecessary renders.
Using react-map-context-to-props can help prevents most of them!
How
Installation
npm install react-map-context-to-props -S
Usage Example
;; const Context = React; const Provider = { const name setName = React; const id setId = React; return <ContextProvider value= name setName setId id > children </ContextProvider> ;}; const mapContextToProps = ; { return <p data-hook="id" onClick= >id</p>;}; const ConnectedId = ; { return <p data-hook='name' onClick= >name</p>;}; const ConnectedName = ; { return <Provider> // will only render when prop, id, or setId change <ConnectedId prop=0 /> // will only render when name, or setName change <ConnectedName /> </Provider> ;}