shouldComponentUpdate: function(nextProps, nextState) {
if ((this.props === nextProps) && (this.state === nextState)){
return Boolean(false);
}
return Boolean(true);
},
I am getting this error when I press a button.
} else {
Session.set('usuario', suc);
if (this.state.debug){
console.log(suc);
}
toastr.options = ttr.success;
toastr.success("Welcome User", "Hello!");
FlowRouter.go('login');
}
When it is about to load login, it displays this error in console and freeze the page.
Warning: MainLayout.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.
I dont know how to make it more boolean than that… help?
Not a bug - shouldComponentUpdate
has to return a Boolean primitive (true
/ false
), not a Boolean object. To see why take a look at the following from the React source:
1 Like
shouldComponentUpdate: function(nextProps, nextState) {
if ((this.props === nextProps) && (this.state === nextState)){
return false;
}
return true;
},
same results… I even deleted the sCU() => {} I still get the error message??? D:
C.Home = React.createClass({
getInitialState: function() {
return {
double_back : {current : -1, times : 0},
loading : false,
debug : false
};
},
shouldComponentUpdate: function(nextProps, nextState) {
if ((this.props === nextProps) && (this.state === nextState)){
return false;
}
return true;
},
focusChanged(e){
let eso = current_id ? current_id : 0;
this.setState({double_back : { current: current_id, times: 0 }});
},
to this:
C.Home = React.createClass({
getInitialState: function() {
return {
double_back : {current : -1, times : 0},
loading : false,
debug : false
};
},
focusChanged(e){
let eso = current_id ? current_id : 0;
this.setState({double_back : { current: current_id, times: 0 }});
},
Still get the same error?? o_O
Yeah I see it was my bad, Parent didnt return true I only saw children.
thanks for your reply