How to debug ReactJS's setState -


i'm working on medium sized reactjs application , following error message after click button on component:

warning: setstate(...): can update mounted or mounting component. means called setstate() on unmounted component. no-op. 

how can debug more easily? why doesn't reactjs give me specific component name rule violated?

how it?

you can override console.warn make throw instead of log when provided message matches pattern. in case, you'd do:

var warn = console.warn; console.warn = function(warning) {   if (/(setstate)/.test(warning)) {     throw new error(warning);   }   warn.apply(console, arguments); }; 

the stack trace of error point line causing warnings.


Comments