Svelte 4 support
svelte-adapter-uws supports both Svelte 4 and Svelte 5. All examples in the docs use Svelte 5 syntax ($props(), runes). If you’re on Svelte 4, here’s how to translate.
Side by side
Svelte 5
<script>
import { crud } from 'svelte-adapter-uws/client';
let { data } = $props();
const todos = crud('todos', data.todos);
</script> Svelte 4
<script>
import { crud } from 'svelte-adapter-uws/client';
export let data;
const todos = crud('todos', data.todos);
</script> The only difference is how you receive props: let { data } = $props() in Svelte 5 → export let data in Svelte 4.
Client store API - identical in both versions
The entire client store API uses svelte/store under the hood, which hasn’t changed between Svelte 4 and Svelte 5. Every function works identically in both versions:
on- subscribe to a topiccrud- managed CRUD listlookup- key-value lookup maplatest- latest message on a topiccount- reactive counteronce- single-fire listenerstatus- connection status storeconnect- configure the WebSocket connection
You import them the same way, call them the same way, and subscribe with $store the same way. The only thing that changes is how your component receives its page data from SvelteKit.
Was this page helpful?