Pure render decorator
An ES7 decorator to make React components "pure".
Alternatives
- As of v15.3.0, React provides a
PureComponent
base class to make a component pure. - recompose provides a clean and functional way to make components pure.
Installation
npm install pure-render-decorator
Usage
import Component from 'react';import pureRender from 'pure-render-decorator'; @pureRender { return <div />; }
The above example is the same as using PureRenderMixin
:
var React = ;var PureRenderMixin = ; var Test = React;
As decorators are simply functions, you can also use pureRender()
without the decorator syntax:
import Component from 'react';import pureRender from 'pure-render-decorator'; { return <div />; } Test;