Cookies
You can read incoming cookies during SSR and write them back via Set-Cookie through the Mochi cookies API exposed on both server and client.
<script>
import CookieDemo from './CookieDemo.svelte';
const cuteNames = ['mochi_fan', 'bun_bun', 'pixel_panda', 'tiny_tanuki', 'cloud_kitten', 'waffle_fox', 'cocoa_bear', 'starry_otter', 'maple_duck', 'peach_pup'];
const randomCuteName = cuteNames[Math.floor(Math.random() * cuteNames.length)];
</script>
<CookieDemo defaultUsername={randomCuteName} mochi:hydrate />
More demos
Reloading associated form data How reloading associated data works — after a successful submit, refetch the related list inside enhance(), or rely on the post-POST re-render. Charts with LayerChart How a third-party Svelte component library works in Mochi — LayerChart server-rendered to plain SVG with zero JavaScript, then the same library as mochi:hydrate and mochi:clientOnly islands. Client-only Islands How client-only islands work — components marked mochi:clientOnly skip SSR and mount in the browser, with a fallback snippet until then.