ReactPureComponent
React.PureComponent is a base class in the React library that extends React.Component and provides a built-in optimization for rendering. It implements a default shouldComponentUpdate method that performs a shallow comparison of the current props and state with the next props and state. If the shallow comparison reports no changes, React skips re-rendering the component and its subtree, which can reduce unnecessary updates.
Usage typically involves extending PureComponent rather than Component, for example class MyComponent extends React.PureComponent. The canonical
How it works and when to use it: PureComponent relies on shallow equality for props and state.
Caveats: Since the check is shallow, deep mutations may not trigger a re-render. Mutating nested data without
Relation to other patterns: For functional components, a similar effect is achieved with React.memo. PureComponent is