-
Hi 👋 I am looking for more information about the context property defined in DataFunctionArgs, which is included in the object passed to the loader function when invoked by React Router. What exactly is this property, and how can it be utilized? I have been unable to find any documentation on it. I initially assumed that if a component renders <Outlet context={{foo: "baz"}} />, the context would be passed to the loader function. However, my experiments suggest that this is not the case. export default createBrowserRouter([
{
path: "/todos",
Component: Todo,
loader({params, context}) {
console.log(context) // undefined
}
},
]); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The context object is a way the HTTP server can pass values to Remix The value is set in the HTTP server using the getLoadContext method in the server adapter |
Beta Was this translation helpful? Give feedback.
The context object is a way the HTTP server can pass values to Remix
The value is set in the HTTP server using the getLoadContext method in the server adapter