From 6df67b66a6152be4962ea2e02e791ed868a4097d Mon Sep 17 00:00:00 2001 From: Charly Gomez Date: Thu, 19 Sep 2024 14:33:15 +0200 Subject: [PATCH] Update react-router.mdx --- .../javascript/guides/react/features/react-router.mdx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/platforms/javascript/guides/react/features/react-router.mdx b/docs/platforms/javascript/guides/react/features/react-router.mdx index 26ec85ccc3613..4fec19ee1db2e 100644 --- a/docs/platforms/javascript/guides/react/features/react-router.mdx +++ b/docs/platforms/javascript/guides/react/features/react-router.mdx @@ -84,7 +84,7 @@ You can instrument [`createMemoryRouter`](https://reactrouter.com/en/main/router ### Custom Error Boundaries -When using `react-router`, errors thrown inside route elements will only be re-thrown in **development mode**. In production, these errors won't be surfaced unless manually captured. If you **don't** have a custom error boundary in place, `react-router` will create a default one that "swallows" all errors. +When using `react-router`, errors thrown inside route elements will only be re-thrown in **development mode** while using [`strict mode`](https://react.dev/reference/react/StrictMode). In production, these errors won't be surfaced unless manually captured. If you **don't** have a custom error boundary in place, `react-router` will create a default one that "swallows" all errors. Note, that this only applies to render method and lifecycle errors since React doesn't need error boundaries to handle errors in event handlers. @@ -119,7 +119,9 @@ import * as Sentry from "@sentry/react"; export function YourCustomRootErrorBoundary() { const error = useRouteError() as Error; - Sentry.captureException(error); + React.useEffect(() => { + Sentry.captureException(error); + }, [error]); return (