pure-render
a pure render higher-order function
install
$ npm install --save pure-render
import
api
pureRender(shouldComponentUpdate = notShallowEqual)(Component)
Wraps Component
in a function comparing prevProps
& props
. If shouldComponentUpdate
returns false
, the last value returned by Component(similarProps)
is returned.
By default, if prevProps
and props
have a shallow equality, the value is left untouched. You can use a custom function to compare them:
const customShouldComponentUpdate = prevProps_id !== props_id MyComponent