Clients
React Query client
This package provides a type-safe integration of React Query with WunderGraph. React Query is a data fetching library for React. With just one hook, you can significantly simplify the data fetching logic in your project. And it also covered in all aspects of speed, correctness, and stability to help you build better experiences.
Installation
Configuration
Before you can use the hooks, you need to modify your code generation to include the base typescript client.
Now you can configure the hooks. Create a new file, for example lib/wundergraph.ts
and add the following code:
In your App.tsx
add QueryClientProvider:
Usage
Now you can use the hooks in your components:
useQuery
useQuery (Live query)
useSubscription
useMutation
useFileUpload
useAuth
useUser
queryKey
You can use the queryKey
helper function to create a unique key for the query in a typesafe way. This is useful if you want to invalidate the query after mutating.
Options
You can use all available options from React Query with the hooks.