feat: add LocalStorage component

This commit is contained in:
Eric Y Liu 2021-03-13 14:38:08 -08:00
commit 1f7fe60695
11 changed files with 199 additions and 3 deletions

View file

@ -0,0 +1,9 @@
<script>
import Preview from "../../components/Preview.svelte";
</script>
This utility component wraps the [Window.localStorage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) to persist values by key. This is useful for non-persistent data (e.g., dark mode toggle).
### Reactive example
<FileSource src="/framed/LocalStorage/LocalStorage" />