You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In React 17 this error got logged to the console (and triggered the error overlay in create-react-app) regardless of whether ThrowInEffect was a child of an Error Boundary or not.
In React 18 (createRoot and legacy root API) an Error Boundary will prevent logging that error to the console (and not trigger the error overlay in create-react-app).
Errors during render work like they did in React 17.
eps1lon
changed the title
Error boundaries actually catch errors in effects
Error boundaries actually catches errors in effects
Jun 21, 2021
eps1lon
changed the title
Error boundaries actually catches errors in effects
React 18: Error boundaries actually catches errors in effects
Jun 21, 2021
Uh oh!
There was an error while loading. Please reload this page.
Given
In React 17 this error got logged to the console (and triggered the error overlay in create-react-app) regardless of whether
ThrowInEffect
was a child of an Error Boundary or not.In React 18 (
createRoot
and legacy root API) an Error Boundary will prevent logging that error to the console (and not trigger the error overlay in create-react-app).Errors during render work like they did in React 17.
Behavior in React 17: https://codesandbox.io/s/react-17-error-boundaries-vp21e?file=/src/index.js
Behavior in React 18: https://codesandbox.io/s/react-18-error-boundaries-psd56?file=/src/index.js
Recording of effect errors in React 17 and 18 and with and without Error Boundaries_
react18-error-boundaries.mp4
The text was updated successfully, but these errors were encountered: