0.2.0 • Published 6 years ago

rc-pure v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

rc-pure

npm version npm downloads github issues greenkeeper status

a react package that improves render performance by reducing re-render component, fast and easy use!

reference

rc-pure-component

a wrapper use pure component wrap stateless functional components to class use pure component to reduce re-render. read more

install

# use npm
$ npm install rc-pure

# or yarn
$ yarn add rc-pure

usage

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)

documents

config

nametypedescription
compareFunc(optional) the function used to calculate the change value. default: lodash.isEqual
updateByKeysArray(optional) Only update when these values change. default: undefined