Vue Query client
This package provides a type-safe integration of Vue Query with WunderGraph. Vue Query is a data fetching library for Vue. 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.
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:
main.ts register your the vue-query plugin:
Now you can use the hooks in your components:
useQuery (Live query)
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.
You can use all available options from Vue Query with the hooks.