I added lifecycle method to my React component
shouldComponentUpdate(nextProps, nextState) {
console.log(nextProps, nextState);
console.log(this.props, this.state);
return false;
},
My issue is that this method is called on the component even when nextProps, and nextState, is exactly the same as the current props and state. When I compare the console.log statements for nextProps and this.props the are exactly the same. Same with the state.
So why is shouldComponentUpdate called?
It is called whenever I change the state of the parent component. But none of the props or state are changing on the actual component. So why is it called?
fyi, I am using React with Meteor
Further Clarification:
I am wondering why the function shouldComponentUpdate
is being called in the first place. None of the state or props of that component are changing. But the state of the parent component is changing.