Explain the role of React.PureComponent.

React.PureComponent is a base class for components that only re-render when there’s a change in shallow props or state comparison. It’s useful for optimizing class components.

class MyComponent extends React.PureComponent {
  render() {
    return <div>{this.props.data}</div>;
  }
}