pure-render-mixin

Facebook's PureRenderMixin for React as an isolated module. Read Facebook's write up on why this is useful for increasing react component rendering performance.

Usage no npm install needed!

<script type="module">
  import pureRenderMixin from 'https://cdn.skypack.dev/pure-render-mixin';
</script>

README

PureRenderMixin

Facebook's PureRenderMixin for React as an isolated module. Read Facebook's write up on why this is useful for increasing react component rendering performance.

Installation

  npm install pure-render-mixin

Usage

Instructions taken verbatim from Facebook's pure-render-mixin page.

var PureRenderMixin = require('pure-render-mixin').PureRenderMixin;
React.createClass({
  mixins: [PureRenderMixin],

  render: function() {
    return <div className={this.props.className}>foo</div>;
  }
});

For convenience shallowCompare and shallowEqual are exported for creating variants of this implementation for special cases:

var shallowCompare = require('pure-render-mixin').shallowCompare;
var shallowEqual = require('pure-render-mixin').shallowEqual;