What are React Mixins?

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],
// ...
});

Author of content
Edit this page

Made by Michael Sakhniuk

Twitter