An open API service indexing awesome lists of open source software.

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

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