@eslym/svelte-utility-stores
v1.0.0
Published
Some utility svelte stores
Downloads
21
Readme
@eslym/svelte-utility-stores
Some utility svelte stores
Install
npm i -D @eslym/svelte-utility-stores
yarn add -D @eslym/svelte-utility-stores
Usage
<script>
import { array } from '@eslym/svelte-utility-stores';
const arr = array(['item 1', 'item 2']);
</script>
<!-- just use .push for the array -->
<button type="button" on:click={()=>$arr.push(`item ${$arr.length + 1}`)}>Add Item</button>
<ul>
{#each $arr as item}
<li>{item}</li>
{/each}
</ul>
More example on this Svelte REPL