Closed babycourageous closed 4 years ago
I've also found a simple way to do a localStorage
that uses a watch to update the store
<script>
let lStore = {};
let storeKey = "MY_STORE";
try {
lstore = JSON.parse(localStorage.getItem(storeKey));
} catch (e) {}
$: if (lStore) {
localStorage.setItem(storeKey, JSON.stringify(lStore));
}
lStore.name = lStore.name || 'world';
</script>
<input bind:value="{lStore.name}" />
<h1>Hello {lStore.name}!</h1>
thanks @dasDaniel, i will add that in
Adds Client Side Storage recipe