Access loaders data from different clients using fetch
#9354
Unanswered
spacepolice10
asked this question in
Q&A
Replies: 1 comment 7 replies
-
You can use a resource route for that https://remix.run/docs/en/main/guides/resource-routes. For UI routes you will need to use an internal ?_data=routeId search params or if you use single fetch .data?_route=routeId. Since this is already going to change in single fetch and may change again in the future without being a breaking change (it’s an internal implementation detail), the recommended way is to use a resource route. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
Is it possible to access JSON data through
await fetch
request made from client-side component or from different application? Right now if I try to fetch loader (likefetch(**ROUTE_URL**).then(data => data.json())
) by its URL I receive the whole page (HTML) which is, I guess, correct but I would like to access JSON returned from loader via fetch. That will simplify making React Native version of application by exploiting Remix version as a backend. Any way to achieve something like that?Beta Was this translation helpful? Give feedback.
All reactions