0 votes
in ReactJS by
What are React Mixins?

1 Answer

0 votes
by

Mixins are a way to totally separate components to have a common functionality. Mixins should not be used and can be replaced with higher-order components or decorators.

One of the most commonly used mixins is PureRenderMixin. You might be using it in some components to prevent unnecessary re-renders when the props and state are shallowly equal to the previous props and state:

const PureRenderMixin = require('react-addons-pure-render-mixin')

const Button = React.createClass({

  mixins: [PureRenderMixin],

  // ...

})

...