diff --git a/content/docs/reference-react-component.md b/content/docs/reference-react-component.md index 1eeb9c4b2..37a5a9b86 100644 --- a/content/docs/reference-react-component.md +++ b/content/docs/reference-react-component.md @@ -413,6 +413,12 @@ class ErrorBoundary extends React.Component { } ``` +Production and development builds of React slightly differ in the way `componentDidCatch()` handles errors. + +On development, the errors will bubble up to `window`, this means that any `window.onerror` or `window.addEventListener('error', callback)` will intercept the errors that have been caught by `componentDidCatch()`. + +On production, instead, the errors will not bubble up, which means any ancestor error handler will only receive errors not explictly caught by `componentDidCatch()`. + > Note > > In the event of an error, you can render a fallback UI with `componentDidCatch()` by calling `setState`, but this will be deprecated in a future release.