Skip to content

Passing Server-Side Values to Loader #13319

Answered by sergiodxa
GWjun asked this question in Q&A
Discussion options

You must be logged in to vote

The context received by loaders and actions is passed from the HTTP server (e.g. Express) to React Router using getLoadContext in the server adapter.

The entry.server is not the place to change it as the code there runs after loaders, not before.

That said, if you enable (unstable) middleware you can use middleware functions in routes to inject things into context.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by GWjun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants