Skip to content

useCounter ​

Category
Utilities

Hook that manages a counter with increment, decrement, reset, and set functionalities

typescript
import { useCounter } from '@elysiumorg/solid-use';

Usage ​

typescript
const { count, dec, inc, reset, set } = useCounter(5);

Demo ​

Api ​

Parameters

NameTypeDefaultNote
initialValue?number0The initial number value
options.min?numberNumber.NEGATIVE_INFINITYThe min of count value
options.max?numberNumber.POSITIVE_INFINITYThe max of count value
options.delay?number-The delay in milliseconds for smooth increment and decrement