React tells you to avoid at maximum scenarios, this will cause a performance issues.
React is very smart at updating the component elements, use key where you need to, react will match the updates and update the DOM. React itself does the comparison of the previous and new props and update the dom.
Use shouldComponentUpdate() to let React know if a component’s output
is not affected by the current change in state or props. The default
behavior is to re-render on every state change, and in the vast
majority of cases you should rely on the default behavior.
As per react component will re-render only if the state is changed.
This method only exists as a performance optimization. Do not rely on
it to “prevent” a rendering, as this can lead to bugs. Consider using
the built-in PureComponent instead of writing shouldComponentUpdate()
by hand. PureComponent performs a shallow comparison of props and
state, and reduces the chance that you’ll skip a necessary update.
Source: https://reactjs.org/docs/react-component.html#shouldcomponentupdate
If you still want to use that you need to measure downside and upside for this. I think you should avoid it completely, because there are higher chances that you might mess up the things by comparing.
PureComponenthas a loop of conditions (Shallow) that checks whether the props has changed - Consider that this also cost performance, sometimes even more than without it. So, it really depends on your specific case.Elementis. You need to use benchmarks to estimate whethershouldComponentUpdateis justified. This is always done like that.