Introducing the new Vue Query client
We're hiring!
We're looking for Golang (Go) Developers, DevOps Engineers and Solution Architects who want to help us shape the future of Microservices, distributed systems, and APIs.
By working at WunderGraph, you'll have the opportunity to build the next generation of API and Microservices infrastructure. Our customer base ranges from small startups to well-known enterprises, allowing you to not just have an impact at scale, but also to build a network of industry professionals.
After React and Solid, we now have official Vue support! 🎉.
This new client is built on top of Vue Query , and brings all the good stuff from WunderGraph to the Vue ecosystem. Query, mutate and subscribe to your WunderGraph API fully typesafe in Vue.
The integration has been built by one of our community members, Hebilicious . Thanks Emmanuel, you rock!
Quick start
Installation
Let's have a quick look at how to set it up in a Nuxt project and how to use it. (this assumes you already have Nuxt and WunderGraph installed).
Install the Vue Query client:
Configuration
Before you can use the hooks, you need to modify your code generation to include the base typescript client.
Now we need to configure the Vue Query client. We'll create a plugin for this.
Usage
Queries
Turn queries into live queries, live queries are refetched on a interval on the WunderGraph server.
Subscriptions
Build realtime apps with subscriptions.
Mutations
Invalidating queries
Let's say we have a query that fetches the current user's profile in one component and we have a form that updates the profile. We can add an onSuccess
handler to the mutation that calls queryClient.invalidateQueries
on the GetProfile
query and trigger a refetch and update the internal React Query cache.
Check out the reference and example app below to learn more about the new Vue Query integration.
Resources
Summary
We're very excited to see the community building integrations for WunderGraph. If you have ideas for other integrations, let us know in the comments below or join us on our Discord server .