svelte-utility-stores Svelte Themes

Svelte Utility Stores

Some utility svelte stores

@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

Top categories

Loading Svelte Themes