Skip to content

Instantly share code, notes, and snippets.

@belmer
Last active February 24, 2016 01:51
Show Gist options
  • Save belmer/2f9746de239130bfcda8 to your computer and use it in GitHub Desktop.
Save belmer/2f9746de239130bfcda8 to your computer and use it in GitHub Desktop.
React debug setState() warning
Paste this on your browser console and navigate to routes without refreshing your browser.
Once this is inplace whenever you get Warning on setState() it should give you the stack trace.
var warn = console.warn;
console.warn = function(warning) {
if (/(setState)/.test(warning)) {
throw new Error(warning);
}
warn.apply(console, arguments);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment