You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creates a type-safe context object that can be used to store and retrieve
34
-
values in middleware, [loaders](../../start/framework/route-module#loader),
35
-
and [actions](../../start/framework/route-module#action). Similar to React's
36
-
[`createContext`](https://react.dev/reference/react/createContext), but
37
-
designed for React Router's request/response lifecycle.
33
+
Creates a type-safe [`unstable_RouterContext`](https://api.reactrouter.com/v7/interfaces/react_router.unstable_RouterContext.html) object that can be used to
34
+
* store and retrieve arbitrary values in [`action`](../../start/framework/route-module#action)s,
35
+
*[`loader`](../../start/framework/route-module#loader)s, and [middleware](../../how-to/middleware).
36
+
* Similar to React's [`createContext`](https://react.dev/reference/react/createContext),
37
+
* but specifically designed for React Router's request/response lifecycle.
38
38
39
-
If a `defaultValue` is provided, it will be returned from `context.get()` when
40
-
no value has been set for the context. Otherwise reading this context when no
41
-
value has been set will throw an error.
39
+
<docs-warning>Enable this API with the `future.unstable_middleware` flag.</docs-warning>
40
+
41
+
If a `defaultValue` is provided, it will be returned from `context.get()`
42
+
when no value has been set for the context. Otherwise, reading this context
ThepatterntomatchagainsttheURLpathname. Thiscanbeastringora [`PathPattern`](https://api.reactrouter.com/v7/interfaces/react_router.PathPattern.html) object. If a string is provided, it will
ThepatterntomatchagainsttheURLpathname. Thiscanbeastringora [`PathPattern`](https://api.reactrouter.com/v7/interfaces/react_router.PathPattern.html) object. If a string is provided, it will be
0 commit comments