Is returning `true` in shouldComponentUpdate the same as not having shouldComponentUdpate?

48 Views Asked by At

In my React Native component, I added an empty shouldComponentUpdate

shouldComponentUpdate(nextProps, nextState) {
        
}

I know from this answer that having an empty shouldComponentUpdate results in eliminating all unnecessary re-renders. If I return true in the body of shouldComponentUpdate though, will that be identical to removing shouldComponentUpdate?

1

There are 1 best solutions below

0
Numan Ijaz On

The default implementation of the method returns true which means in your case removing the shouldComponentUpdate will result in the same behavior.

https://reactjs.org/docs/optimizing-performance.html#shouldcomponentupdate-in-action

enter image description here