Skip to content

Commit c208585

Browse files
committed
chore: generate markdown docs from jsdocs
1 parent e9a17ed commit c208585

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

docs/api/data-routers/RouterProvider.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ implementation. You _almost always_ want to use the version from
4848
function RouterProvider({
4949
router,
5050
flushSync: reactDomFlushSyncImpl,
51+
unstable_onError,
5152
}: RouterProviderProps): React.ReactElement
5253
```
5354

@@ -63,6 +64,24 @@ You usually don't have to worry about this:
6364
- If you are rendering in a non-DOM environment, you can import
6465
`RouterProvider` from `react-router` and ignore this prop
6566

67+
### unstable_onError
68+
69+
An error handler function that will be called for any loader/action/render
70+
errors that are encountered in your application. This is useful for
71+
logging or reporting errors instead of the `ErrorBoundary` because it's not
72+
subject to re-rendering and will only run one time per error.
73+
74+
The `errorInfo` parameter is passed along from
75+
[`componentDidCatch`](https://react.dev/reference/react/Component#componentdidcatch)
76+
and is only present for render errors.
77+
78+
```tsx
79+
<RouterProvider unstable_onError=(error, errorInfo) => {
80+
console.error(error, errorInfo);
81+
reportToErrorService(error, errorInfo);
82+
}} />
83+
```
84+
6685
### router
6786

6887
The [`DataRouter`](https://api.reactrouter.com/v7/interfaces/react_router.DataRouter.html) instance to use for navigation and data fetching.

docs/api/framework-routers/HydratedRouter.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,21 @@ available to
3838
[`clientAction`](../../start/framework/route-module#clientAction)/[`clientLoader`](../../start/framework/route-module#clientLoader)
3939
functions
4040

41+
### unstable_onError
42+
43+
An error handler function that will be called for any loader/action/render
44+
errors that are encountered in your application. This is useful for
45+
logging or reporting errors instead of the `ErrorBoundary` because it's not
46+
subject to re-rendering and will only run one time per error.
47+
48+
The `errorInfo` parameter is passed along from
49+
[`componentDidCatch`](https://react.dev/reference/react/Component#componentdidcatch)
50+
and is only present for render errors.
51+
52+
```tsx
53+
<HydratedRouter unstable_onError={(error, errorInfo) => {
54+
console.error(error, errorInfo);
55+
reportToErrorService(error, errorInfo);
56+
}} />
57+
```
58+

0 commit comments

Comments
 (0)