a react package that improves render performance by reducing re-render component, fast and easy use!
a wrapper use pure component wrap stateless functional components to class use pure component to reduce re-render. read more
# use npm
$ npm install rc-pure
# or yarn
$ yarn add rc-pure
import pure from 'rc-pure'
const config = {
updateByKeys: ['name'],
}
const Component = ({ name = 'Hieu' }) => (<div>hello, {name}</div>)
// with config
const Pure = pure(config)(Component)
// simple
const Pure = pure()(Component)
name | type | description |
---|---|---|
compare | Func | (optional) the function used to calculate the change value. default: lodash.isEqual |
updateByKeys | Array | (optional) Only update when these values change. default: undefined |