React · Senior · Question 75 of 75
Why are error boundaries still written as classes (or provided by a library)?
- ✓Correct answer: Catching render errors requires
componentDidCatch/getDerivedStateFromError, which have no hook equivalents yet - 2Classes render faster
- 3Function components can't render fallback UI
Explanation
Most teams write one reusable boundary (or use react-error-boundary) and place it around routes and independent widgets.