Skip to content

Instantly share code, notes, and snippets.

@louisptremblay
Last active December 13, 2016 18:47
Show Gist options
  • Save louisptremblay/69341fe9cc8ccfc4cc8254c83c45d34c to your computer and use it in GitHub Desktop.
Save louisptremblay/69341fe9cc8ccfc4cc8254c83c45d34c to your computer and use it in GitHub Desktop.
// When getting error: "Cannot read property 'componentWillUnmount' of null"
// It's because React is swallowing the exception without rethrowing it
// In ReactCompositeComponent.js, edit lines that look like this, and add the Catch part
if (canInstantiate) {
if (process.env.NODE_ENV !== 'production') {
ReactCurrentOwner.current = this;
try {
inst = new Component(publicProps, publicContext, ReactUpdateQueue);
} catch (ex) {
console.log(ex);
debugger;
} finally {
ReactCurrentOwner.current = null;
}
} else {
inst = new Component(publicProps, publicContext, ReactUpdateQueue);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment