plugin: React-Query for Data Fetching #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Plugin features when merged
@tanstack/react-query
for use on Browser, Mobile and Serverside@tanstack/react-query
to create aUniversalRouteScreen
wrapper for data fetching everywhereRecommended workflow
1. Start with component & bridge in
/screens/
folderSomeScreen.tsx
2. Use bridge & component in workspace
/routes/
folder/routes/subpages/[slug]/index.ts
-- in e.g. the@app/core
workspace3. Reexport route file in Expo & Next.js app routers
app/subpages/[slug]/index.ts
in@app/expo
workspaceapp/subpages/[slug]/page.ts
in@app/next
workspace💡 Improving it with GraphQL
This is fully optional, but pairing this pattern with something like GraphQL (e.g. #5 plugin: Apollo GraphQL) is actually a great combo, because:
This is one of the reasons I recommend GraphQL for fetching data in Universal apps. We recommend you create or use some universal GraphQL fetcher together with graphql.tada 🪄
🚀 We've perfected this Universal Data Fetching pattern in the FullProduct.dev ⚡️ Starterkit.
Official
@tanstack/react-query
docshttps://tanstack.com/query/latest/docs/framework/react/overview