In my React Native app I have a PureComponent where I log whether props or state have changed each time shouldComponentUpdate()
is called, like this:
shouldComponentUpdate(nextProps, nextState) {
console.log(JSON.stringify(this.props) === JSON.stringify(nextProps))
console.log(JSON.stringify(this.state) === JSON.stringify(nextState))
return true
}
In one instance, this outputs true
and true
, meaning neither props nor state have changed. I thought that in order for shouldComponentUpdate()
to get called, one of these has to change. What could cause it to get called when neither has changed?