Error Boundary là React component bắt JavaScript errors trong component tree con và hiển thị fallback UI thay vì crash toàn app.
- Chỉ có thể tạo với Class Component implement
getDerivedStateFromError(set error state) vàcomponentDidCatch(log error). - Thư viện react-error-boundary cung cấp
ErrorBoundarycomponent tiện dụng hơn.