Chapter 16 · Example 6 · Universal error handling in React

useThrowAsyncError hook

Abstracting the re-throw trick into a hook gives an error thrower and a callback wrapper, letting one ErrorBoundary catch errors from promises and event handlers.

Loading live editor…