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
View Transitions How view transitions work — drop <ViewTransitions /> into a layout to animate full-page navigations with zero JavaScript. Error Handling How error handling works — catch render errors and unmatched routes via Mochi.serve()'s errorPage option and the handleError hook. Cookie Vary Test How cookie-partitioned caching works — a page that sets Vary: Cookie so responses key on cookies.