5 min read
•Question 18 of 48mediumError Boundaries
Handling errors gracefully in React.
What are Error Boundaries?
Error boundaries are React components that catch JavaScript errors in their child component tree, log those errors, and display a fallback UI.
Key Points
- Only class components can be error boundaries
- They catch errors during rendering, lifecycle methods, and constructors
- They do NOT catch errors in event handlers, async code, or SSR