1. Utilities
  2. cycleList

Utilities

cycleList

Cycle through a list of items.

Demo

10

Usage

        <script>
  import { cycleList } from "sveltronics";

  let list = [10, 20, 30, 40, 50];

  let { state, next, prev } = cycleList(list);
</script>

<div>
  <div>
    {$state}
  </div>
  <button on:click={next}>Next</button>
  <button on:click={prev}>Prev</button>
</div>

      

Previous <- counter