https://github.com/nicobarray/use-timed-index
React hook to get a timed, incrementing index
https://github.com/nicobarray/use-timed-index
Last synced: 5 months ago
JSON representation
React hook to get a timed, incrementing index
- Host: GitHub
- URL: https://github.com/nicobarray/use-timed-index
- Owner: nicobarray
- Created: 2019-02-11T19:30:20.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-11T22:28:13.000Z (over 7 years ago)
- Last Synced: 2025-10-03T12:28:38.151Z (9 months ago)
- Language: JavaScript
- Size: 56.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
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
```jsx
function App() {
// Update the index value by 1 about every 1500ms
const index = useTimedIndex(1500);
return
{index}
}
```
### Install
Has `react` as --peer dependency.
```javascript
yarn add use-timed-index
```
or
```javascript
npm i use-timed-index
```
## Created by
- [Nicolas Barray](https://github.com/nicobarray)
## License
MIT