Before anyone marks this as a duplicate, I went through this question ReactJS Warning: Thumbnails.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false and it doesn't answer my question (or I wasn't able to get it (to say the least)
so this my code
shouldComponentUpdate(nextProps, nextState) {
console.log(this.props.order, nextProps.order)
if (nextProps.order !== this.props.order) {
return true;
}
}
Here when I check the console log in chrome, it throws a warning saying
shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false
But everything works as expected (or the way I want to), Also when I do something like
shouldComponentUpdate(nextProps, nextState) {
console.log(this.props.order, nextProps.order)
return nextProps.order !== this.props.order
}
It doesn't throw an error.
[Question] Why am i getting that warning? when I clearly return true?
else return falseafter if, you only returned true