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.
Here 1st sentence says state or props but 2nd sentence says every state change, which one is correct ?
shouldComponentUpdate takes nextProps and nextState as parameters and you can decide if the component should rerender (e.g. if props are changed) or should not (e.g. if state is changed, but for some reason you don’t want rerender). The default behavior is to rerender only on state changes.