Mixins

mixins is a React feature that allows you to share cross cutting concerns with components. A mixin is simply an Object Literal that is used to add behavior to a component. It's an implementation of the decorator pattern and the mixin you create can provide implementations of React's component lifecycle events (componentWillMount, componentDidMount, and so on) and those will be called during your component's lifecycle along with the component's lifecycle methods.

Note

Here are the details from React's documentation:

A nice feature of mixins is that if a component is using multiple mixins and several mixins define the same lifecycle method (i.e. several mixins want to do some cleanup when the component is destroyed), all of the lifecycle methods ...

Get React: Building Modern Web Applications 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.