Passing data to loader when calling useLoaderData #4056
filiplikavcan
started this conversation in
Proposals
Replies: 1 comment 2 replies
-
The only way to pass parameters to the loader function is through the URL. Also useLoaderData doesn't do the fetch itself, the data is fetched outside React and stored in a context, the hook only access that context. This is the actual code of the hook, as you can see it's just a single line: remix/packages/remix-react/components.tsx Lines 1416 to 1418 in f4d6ff6 So it wouldn't be possible to pass parameters to the loader this way. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This would allow to do things like
useLoaderData(useOutletContext())
- that is to parametrize loader not only with the request but also with the outlet context.Beta Was this translation helpful? Give feedback.
All reactions