I have a variable checked in my __layout.svelte and I want to have the value remain unchanged between page navigations. Instead when I navigate to a new page checked gets reset back to the default, false. Is there a way to simply persist layout or app state between page loads?
The context for the question is that I need to maintain the value of checked, which is a manual dark mode switch, across page navigations in the app.
<!-- __layout.svelte -->
<script>
let checked = false
$: checked, console.log('checked is', checked)
</script>
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/contact">Contact</a>
<div style="margin-top:2em">
<label>
<input type="checkbox" bind:checked/>
a checkbox...
</label>
</div>
<slot></slot>
