Q68: What is onUncaughtError and how does createRoot handle unhandled error options?
Modern ReactDOM.createRoot options include explicit root error handlers: onUncaughtError (uncaught error during rendering), onCaughtError (errors caught by Error Boundaries), and onRecoverableError (errors React recovers from automatically). This allows centralized telemetry and error reporting.
Key Takeaways
- Root options provide granular hooks for tracking application errors.
- Distinguishes between boundary-caught errors, uncaught crashes, and recoverable errors.
Knowledge Check
Which root callback option catches errors that were successfully handled by an Error Boundary?