Let's start by configuring WunderGraph.
What's notable here is that we're using
templates.typescript.client to generate our base client that is used by SWR
Next up is setting up the SWR hooks.
WunderGraph comes with a powerful framework for generating code. Here we are creating fully typed SWR hooks based on the operations of our WunderGraph application.
Define an Operation
Run Queries from Next.js
Run Mutations from Next.js
Run Subscriptions from Next.js
Note: Subscriptions are currently not supported with SSR.
Authentication from Next.js
Note: Logout() will trigger a refetch of the user.