useStopwatch ​
Hook that creates a stopwatch functionality
typescript
import { useStopwatch } from '@siberiacancode/reactuse';
Usage ​
typescript
const { seconds, minutes, start, pause, reset } = useStopwatch(1000, { enabled: false });
Demo ​
Api ​
Parameters
Name | Type | Default | Note |
---|---|---|---|
initialTime? | number | 0 | The initial time of the timer |
options.enabled? | boolean | true | The enabled state of the timer |
Returns
Parameters
Name | Type | Default | Note |
---|---|---|---|
options.initialTime? | number | 0 | -The initial time of the timer |
options.enabled? | boolean | true | The enabled state of the timer |