DeadDjangoDjoker
DeadDjangoDjoker

Reputation: 602

Can i access Loader data in Action function in remix.run?

Can I access the loader function data in remix inside action Function without passing it from the form or submit function.

something like using useLoaderData inside action Function.

Upvotes: 9

Views: 6825

Answers (1)

Kiliman
Kiliman

Reputation: 20322

No. useLoaderData and useActionData are both hooks used by the UI component once the data is returned from the loader/action.

You will either need to pass the data to the action via FormData, URLSearchParams, or URL params.

You can also store data in session or cookies and access it from your action.

Upvotes: 12

Related Questions