score:0

You can use memo to handle this scenario:

const MyComponent = React.memo(function MyComponent(props) {
  /* only rerenders if props change */
});

Such component will only be re-rendered when there is a change in its own state or props.


Related Query

More Query from same tag