Chapter 16 · Example 5 · Universal error handling in React

Re-throwing async errors

Catching an async error with try/catch then re-throwing it inside a setState updater function pushes it back into the render lifecycle so ErrorBoundary catches it.

Loading live editor…