[]previous and next page

Root error reporters

render and hydrate take three optional reporters, for logging and monitoring:

For agentsUpdated

render and hydrate take three optional reporters, for logging and monitoring:

ts
render(() => <App />, root, {
  onCaughtError: (error) => report(error, "boundary"), // an ErrorBoundary took it (its fallback is shown)
  onUncaughtError: (error) => report(error, "root"),   // no boundary took it; the root does not rethrow
});

hydrate(() => <App />, root, {
  onRecoverableError: (error) => report(error, "hydration"), // the server markup differed; it was repaired
});

Without the options the behavior is unchanged: an error nobody handles reaches the caller. onRecoverableError reports a server element the client did not find (the client creates it). Static markup inside a keyed template root is adopted as the server wrote it, so such a difference is not reported.