@bianic-ui/counter

A React hook for managing counters

Usage no npm install needed!

<script type="module">
  import bianicUiCounter from 'https://cdn.skypack.dev/@bianic-ui/counter';
</script>

README

Counter

A React hook that provides simple and advance counter functionalities. Mostly used to create numeric inputs and countdown timers.

Installation

yarn add @bianic-ui/counter

# or

npm i @bianic-ui/counter

Import hook

import { useCounter } from "@bianic-ui/counter"

Basic usage

export function Example() {
  const counter = useCounter({
    max: 10,
    min: 0,
    step: 0.1,
  })

  return (
    <div>
      <button onClick={() => counter.increment()}>Increment</button>
      <p>{counter.value}</p>
      <button onClick={() => counter.decrement()}>Decrement</button>
    </div>
  )
}