{"_id":"react-pure-render","_rev":"211726","name":"react-pure-render","description":"A function, a component and a mixin for React pure rendering","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"gaearon","email":""}],"time":{"modified":"2021-06-03T15:30:19.000Z","created":"2015-05-04T20:50:07.211Z","1.0.2":"2015-06-11T18:32:06.760Z","1.0.1":"2015-05-04T21:06:58.655Z","1.0.0":"2015-05-04T20:50:07.211Z"},"users":{"princetoad":true,"rwaness":true,"nelix":true,"nisimjoseph":true,"devalphac":true,"donggw2030521":true},"author":{"name":"Dan Abramov","email":"dan.abramov@me.com","url":"http://github.com/gaearon"},"repository":{"type":"git","url":"git+https://github.com/gaearon/react-pure-render.git"},"versions":{"1.0.2":{"name":"react-pure-render","version":"1.0.2","description":"A function, a component and a mixin for React pure rendering","main":"index.js","repository":{"type":"git","url":"git+https://github.com/gaearon/react-pure-render.git"},"scripts":{"build":"./scripts/build","prepublish":"npm run build"},"keywords":["react","pure","render","shouldComponentUpdate","optimization","performance"],"author":{"name":"Dan Abramov","email":"dan.abramov@me.com","url":"http://github.com/gaearon"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-pure-render/issues"},"homepage":"https://github.com/gaearon/react-pure-render","devDependencies":{"babel":"^5.2.9","babel-eslint":"^3.0.1","eslint":"^0.20.0"},"gitHead":"7bd0f7c0a87369d85ca32c73483a18741bb88875","_id":"react-pure-render@1.0.2","_shasum":"9d8a928c7f2c37513c2d064e57b3e3c356e9fabb","_from":".","_npmVersion":"2.11.0","_nodeVersion":"2.2.1","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"dist":{"shasum":"9d8a928c7f2c37513c2d064e57b3e3c356e9fabb","size":3578,"noattachment":false,"key":"/react-pure-render/-/react-pure-render-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-pure-render/download/react-pure-render-1.0.2.tgz"},"maintainers":[{"name":"gaearon","email":""}],"directories":{},"publish_time":1434047526760,"_cnpm_publish_time":1434047526760,"_hasShrinkwrap":false},"1.0.1":{"name":"react-pure-render","version":"1.0.1","description":"A function, a component and a mixin for React pure rendering","main":"index.js","repository":{"type":"git","url":"https://github.com/gaearon/react-pure-render.git"},"scripts":{"build":"./scripts/build","prepublish":"npm run build"},"keywords":["react","pure","render","shouldComponentUpdate","optimization","performance"],"author":{"name":"Dan Abramov","email":"dan.abramov@me.com","url":"http://github.com/gaearon"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-pure-render/issues"},"homepage":"https://github.com/gaearon/react-pure-render","optionalDependencies":{"babel-eslint":"^3.0.1","eslint":"^0.20.0"},"devDependencies":{"babel":"^5.2.9"},"gitHead":"f512070850ae8c6ba969e8cd07491b635f01a60f","dependencies":{"babel-eslint":"^3.0.1","eslint":"^0.20.0"},"_id":"react-pure-render@1.0.1","_shasum":"36fecc139ca2ab9dc63148fc9ca2e063e3e0b1ec","_from":".","_npmVersion":"2.8.3","_nodeVersion":"1.8.1","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"maintainers":[{"name":"gaearon","email":""}],"dist":{"shasum":"36fecc139ca2ab9dc63148fc9ca2e063e3e0b1ec","size":3246,"noattachment":false,"key":"/react-pure-render/-/react-pure-render-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-pure-render/download/react-pure-render-1.0.1.tgz"},"directories":{},"publish_time":1430773618655,"_cnpm_publish_time":1430773618655,"_hasShrinkwrap":false},"1.0.0":{"name":"react-pure-render","version":"1.0.0","description":"A function, a component and a mixin for React pure rendering","main":"modules/index.js","repository":{"type":"git","url":"https://github.com/gaearon/react-pure-render.git"},"scripts":{"build":"./scripts/build","prepublish":"npm run build"},"keywords":["react","pure","render","shouldComponentUpdate","optimization","performance"],"author":{"name":"Dan Abramov","email":"dan.abramov@me.com","url":"http://github.com/gaearon"},"license":"MIT","bugs":{"url":"https://github.com/gaearon/react-pure-render/issues"},"homepage":"https://github.com/gaearon/react-pure-render","optionalDependencies":{"babel-eslint":"^3.0.1","eslint":"^0.20.0"},"devDependencies":{"babel":"^5.2.9"},"gitHead":"15bd6ccb9b33bb4a3641c45af540b0382eaf1efd","dependencies":{"babel-eslint":"^3.0.1","eslint":"^0.20.0"},"_id":"react-pure-render@1.0.0","_shasum":"190b538a26e78842a15ce3720a1b4666824f06a6","_from":".","_npmVersion":"2.8.3","_nodeVersion":"1.8.1","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"maintainers":[{"name":"gaearon","email":""}],"dist":{"shasum":"190b538a26e78842a15ce3720a1b4666824f06a6","size":3252,"noattachment":false,"key":"/react-pure-render/-/react-pure-render-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/react-pure-render/download/react-pure-render-1.0.0.tgz"},"directories":{},"publish_time":1430772607211,"_cnpm_publish_time":1430772607211,"_hasShrinkwrap":false}},"readme":"# react-pure-render\n\nA function, a component and a mixin for React pure rendering.\n\nThis module provides *exactly* the same functionality as [PureRenderMixin](https://facebook.github.io/react/docs/pure-render-mixin.html), but as a standalone module and in three different flavors.\n\n### Usage\n\n#### Function\n\nThis is my preferred method, but it requires ES7 [class property transform](https://gist.github.com/jeffmo/054df782c05639da2adb) to be enabled by putting `{ \"stage\": 0 }` in your [.babelrc](https://babeljs.io/docs/usage/babelrc/).\n\n```js\nimport shouldPureComponentUpdate from 'react-pure-render/function';\n\nexport default class Button {\n  shouldComponentUpdate = shouldPureComponentUpdate;\n\n  render() { }\n}\n```\n\n#### Component\n\nInheritance is not very cool but it doesn't hurt a lot if it's just for the sake of this single method. If you don't want to use stage 0 transforms, you can use a base class instead:\n\n```js\nimport PureComponent from 'react-pure-render/component';\n\nexport default class Button extends PureComponent {\n  render() { }\n}\n```\n\n#### Mixin\n\nIf you're working with `createClass`-style components, use the mixin. It's exactly the same as [`React.addons.PureRenderMixin`](https://facebook.github.io/react/docs/pure-render-mixin.html).\n\n```js\nvar React = require('react');\nvar PureMixin = require('react-pure-render/mixin');\n\nvar Button = React.createClass({\n  mixins: [PureMixin],\n\n  render: function () { }\n});\n\nmodule.exports = Button;\n```\n\n#### shallowEqual\n\nSometimes `shallowEqual` is all you need. It's bad to reach out into React internals, so this library exposes exactly the same `shallowEqual` you already know and love from React.\n\n```js\nimport shallowEqual from 'react-pure-render/shallowEqual';\nconsole.log(shallowEqual({ x: 42 }, { x: 42 });\n```\n\n### Known Issues\n\nIf a component in the middle of your rendering chain has pure rendering, but some nested component relies on a `context` change up the tree, **the nested component won't learn about `context` change and won't update**. This is a [known React issue](https://github.com/facebook/react/issues/2517) that exists because `context` is not a documented feature and is not finished. However some React libraries already rely on `context`, for example, [React Router](https://github.com/rackt/react-router). My suggestion for now is to use pure components in apps relying on such libraries very carefully, and only use pure rendering for leaf-ish components that are known *not* to rely on any parent `context`.\n\n### Further Reading\n\n* [PureRenderMixin](https://facebook.github.io/react/docs/pure-render-mixin.html)\n* [Advanced Performance](https://facebook.github.io/react/docs/advanced-performance.html)\n\n### License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/gaearon/react-pure-render","bugs":{"url":"https://github.com/gaearon/react-pure-render/issues"},"license":"MIT"}