I have a component that is receiving same props always.When I compare them in shouldComponentUpdate()
lifecycle,it returns false
shouldComponentUpdate(nextProps,nextState){
if(this.props === nextProps){return false;} //returns false
else return true;
}
However If I compare current vs previous state having same value,they work fine and return true
shouldComponentUpdate(nextProps,nextState){
if(this.state === nextState){return false;}
else return true; //return true
}
Both state and props are objects(reference type) but why they are behaving differently?