React 19 Support

8.6.0 of the Sentry React and Next.js SDKs add support for React 19 and its new error handling hooks. This means that Sentry will automatically attach your component stack to every new error, making it easy to know where to look in your component tree for debugging.

If you are using react-dom directly, you can define the onUncaughtError and onCaughtError hooks to get extra component related information attached to your React errors. Learn more here .

import { createRoot } from "react-dom/client";

const container = document.getElementById("app");
const root = createRoot(container, {
  // Callback called when an error is thrown and not caught by an ErrorBoundary.
  onUncaughtError: Sentry.reactErrorHandler((error, errorInfo) => {
    console.warn('Uncaught error', error, errorInfo.componentStack);
  }),
  // Callback called when React catches an error in an ErrorBoundary.
  onCaughtError: Sentry.reactErrorHandler(),
  // Callback called when React automatically recovers from errors.
  onRecoverableError: Sentry.reactErrorHandler(),
});
root.render();
Your code is broken. Let's Fix it.
Get Started