rspc is no longer maintained. These docs are kept for reference.
Svelte
Use the typed client as a Svelte query function.
Use the vanilla client as a TanStack Query request function. This avoids depending on the experimental rspc Svelte adapter's context setup.
The example below uses the Svelte 4 store-based API with TanStack Svelte Query 5.71.10. For a newer adapter generation, follow its setup guide and keep the typed client.query call as the query function.
Provide a query client
src/App.svelte
Call a query
Create api.ts using the quickstart client setup, then use it in a child component:
src/Version.svelte
For server-side rendering, create query clients per request and use a server-reachable API URL. Do not share a cache containing user-specific data across requests.
