Skip to content

Instantly share code, notes, and snippets.

@dacioromero
Created May 6, 2021 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dacioromero/43955cf1c879edeb622a882c365ccdce to your computer and use it in GitHub Desktop.
Save dacioromero/43955cf1c879edeb622a882c365ccdce to your computer and use it in GitHub Desktop.
<script lang="typescript">
import { writable } from 'svelte/store'
const store = writable(localStorage.getItem('key') ?? '')
store.subscribe(value => localStorage.setItem('key', value))
</script>
<input bind:value={$store} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment