InterviewHubPRO
Section Overview
Q444

Question 444 of 445

Part 11: Legacy Architecture, Migration Patterns & Historical Internals (354 - 445)

100%
React & Modern Frontend (445 Qs)•Part 11: Legacy Architecture, Migration Patterns & Historical Internals (354 - 445)

What are React Mixins?

⚠️ DEPRECATED: Mixins are considered legacy and should not be used in modern React applications.

markdown
_Mixins_ were a way to share common functionality between components using `React.createClass()`. However, they caused several problems:
- Implicit dependencies
- Name clashes
- Snowballing complexity

One of the most commonly used mixins was `PureRenderMixin`:
javascript
    const PureRenderMixin = require("react-addons-pure-render-mixin");

    const Button = React.createClass({
      mixins: [PureRenderMixin],
      // ...
    });
markdown
**Modern Alternatives:**
- **React.memo()** for functional components (replaces PureRenderMixin)
- **Custom Hooks** for sharing stateful logic
- **Higher-Order Components (HOCs)** for cross-cutting concerns
- **Render Props** pattern
javascript
    // Modern equivalent using React.memo
    const Button = React.memo(({ onClick, label }) => (
      <button onClick={onClick}>{label}</button>
    ));