use-timed-index
v1.0.2
Published
React hook to get a timed, incrementing index.
Downloads
3
Readme
useTimedIndex
Get an index value auto-incremented by 1 every X ms.
What ?
useTimedIndex is a react hook that outputs a number starting at 0 and incrementing over time. The two arguments are the interval by which the index is incremented and a delay that pause the increment after each step.
Example
function App() {
// Update the index value by 1 about every 1500ms
const index = useTimedIndex(1500);
return <div>{index}</div>
}
Install
Has react
as --peer dependency.
yarn add use-timed-index
or
npm i use-timed-index
Created by
License
MIT