1.0.1 • Published 8 years ago

pure-render v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

pure-render

a pure render higher-order function

install

$ npm install --save pure-render

import

import pureRender from "pure-render"

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, props) =>
  prevProps._id !== props._id

pureRender(customShouldComponentUpdate)(MyComponent)

license