Error Boundaries
Implement class-based Error Boundaries with componentDidCatch and getDerivedStateFromError to prevent uncaught render errors from crashing the entire app.
Why Error Boundaries?
An uncaught error during rendering, in a lifecycle method, or in a constructor crashes the entire React tree by default. Error Boundaries catch these errors in a subtree and let you render a fallback instead.
Only Class Components
Error Boundaries must be class components (still in 2026 — no hook equivalent yet). The hooks useErrorBoundary exists in libraries like react-error-boundary.