PureRenderMixin

"Shawn, PureRenderMixin is an add-on that can be used in place of shouldComponentUpdate. Under the hood, it uses shouldComponentUpdate and compares the current props and state with the next props and states. Let's try it in our code. First, we need to install the add-on, of course." said Mike.

$ npm install react-addons-pure-render-mixin

// src/Header.js

import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';

export default React.createClass({
  mixins: [PureRenderMixin],
     ..
     ..
})

// src/Form.js

import React from 'react';
import PureRenderMixin from 'react-addons-pure-render-mixin';

export default React.createClass({
  mixins: [PureRenderMixin],
  ..
  ..
     }
})

"Shawn, let's see the wasted time now ...

Get ReactJS by Example - Building Modern Web Applications with React now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.