#loader/action context in browser router
1 messages · Page 1 of 1 (latest)
There is not equivalent at the moment in createBrowserRouter. That is a Remix feature for passing server-specific request info into your Remix loaders. When running in the browser, you've got access to the full scope so generally you can get by by just grabbing the thing you need. Generally module scope is recommended, or you could just leverage a shared property on window
hm
my use-case is that i want to be able to run graphql requests in actions/loaders in both client and server context
ideally i could pass a function graphql() into the context, and in the browser it would send an http request, and on the server the loader would execute the graphql request directly against the schema
i have that graphql function for both contexts, but i cant figure out how to inject the right one depending on context