WARNING: These docs are a work in progress! Some sections are incomplete or incorrect.

Svelte

rspc can be used on the frontend with Svelte via Tanstack Svelte Query which provides caching, refetching and a lot more.

To get started first install the required packages.

pnpm i @rspc/client # The core client
pnpm i @rspc/svelte-query # The integration

Then you can do the following:

<script lang="ts">
    import { createSvelteQueryHooks } from "@rspc/svelte-query";
    import type { Procedures } from "../../../../bindings.ts";
 
    const rspc = createSvelteQueryHooks<Procedures>();
 
    const version = rspc.createQuery(["version"]);
</script>
 
<div>
    <p>Using rspc version: {$version.data}</p>
</div>
Edit on GitHub

Last updated on