Handle React Suspense Errors with an Error Boundary

InstructorKent C. Dodds

Share this video with your friends

Send Tweet

Error Boundaries are the way you handle errors with React, and Suspense embraces this completely. Let's take a look at how to handle asynchronous errors with Suspense and Error Boundaries.

Viktor Soroka
~ 5 years ago

When you said that you prefer relying on ErrorBoundary in the app, does it mean that you wrap individual components and thus have multiple instances of it?

Kent C. Doddsinstructor
~ 5 years ago

Think of Error Boundaries as try/catch blocks. It can be useful to have one that wraps the whole app, but then it's good to wrap it around specific places to give more helpful/contextual error messages.