# use-simple-timer

> Simple useTimer Hook for React

Latest version **1.0.6** (published 2022-04-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-simple-timer
pnpm add use-simple-timer
yarn add use-simple-timer
bun add use-simple-timer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2022-04-05 |
| First published | 2022-04-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Baba Dan Constantin |
| Maintainers | danifullstack |
| Keywords | useTimer, React, Hook |

## Links

- npm: https://www.npmjs.com/package/use-simple-timer
- Repository: https://github.com/danifullstackengineer/useTimer
- Homepage: https://github.com/danifullstackengineer/useTimer#readme
- Issues: https://github.com/danifullstackengineer/useTimer/issues
- npm.io page: https://npm.io/package/use-simple-timer

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2022-04-05
- 1.0.5 — 2022-04-05
- 1.0.4 — 2022-04-05
- 1.0.3 — 2022-04-05
- 1.0.2 — 2022-04-05
- 1.0.1 — 2022-04-05
- 1.0.0 — 2022-04-05

## README

<h1 align="center">Welcome to use-simple-timer 👋</h1>
<p>
  <a href="https://www.npmjs.com/package/use-simple-timer" target="_blank">
    <img alt="Version" src="https://img.shields.io/npm/v/use-simple-timer.svg">
  </a>
  <a href="https://github.com/danifullstackengineer/useTimer#readme" target="_blank">
    <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
  </a>
  <a href="https://github.com/danifullstackengineer/useTimer/graphs/commit-activity" target="_blank">
    <img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" />
  </a>
  <a href="https://github.com/danifullstackengineer/useTimer/blob/master/LICENSE" target="_blank">
    <img alt="License: MIT" src="https://img.shields.io/github/license/danifullstackengineer/use-simple-timer" />
  </a>
</p>

> Simple useTimer Hook for React

### 🏠 [Homepage](https://github.com/danifullstackengineer/useTimer#readme)

## Install

```sh
npm install use-simple-timer
```

## Usage

```sh
import useTimer from 'use-simple-timer';

const [{seconds, setSeconds, toggle, reset, isActive, setIsActive, isPaused, setIsPaused}] = useTimer()

```

## Available variables

```sh
seconds:number -> The seconds that passed.

setSeconds:React.Dispatch<React.SetStateAction<number>> -> Sets the seconds to a value(use milliseconds, i.e. if you want to set the seconds to 3, then setSeconds(3000)).

toggle:()=>void -> toggles the isActive variable.

reset:()=>void -> resets the timer(i.e. if seconds is 3, then after calling reset, seconds will be 0. Does not stop the timer).

isActive:boolean -> returns true if timer is active, false if it is stopped. Default = true.

setIsActive:React.Dispatch<React.SetStateAction<boolean>> -> Sets isActive.

isPaused:boolean -> returns true if timer is paused, false if it is not paused. Default = false.

setIsPaused:React.Dispatch<React.SetStateAction<boolean>> -> Sets isPaused.
```

## Modify the time for the timer

```sh
const [{seconds}] = useTimer(3000) - Now the timer works once every 3 seconds. Default is 1 second if no number is specified.
```

## Author

👤 **Baba Dan Constantin**

- Website: Baba Dan Constantin
- Github: [@danifullstackengineer](https://github.com/danifullstackengineer)

## 🤝 Contributing

Contributions, issues and feature requests are welcome!<br />Feel free to check [issues page](https://github.com/danifullstackengineer/useTimer/issues). You can also take a look at the [contributing guide](https://github.com/danifullstackengineer/useTimer/blob/master/CONTRIBUTING.md).

## Show your support

Give a ⭐️ if this project helped you!

## 📝 License

Copyright © 2022 [Baba Dan Constantin](https://github.com/danifullstackengineer).<br />
This project is [MIT](https://github.com/danifullstackengineer/useTimer/blob/master/LICENSE) licensed.

---

_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

---
_Source: https://npm.io/package/use-simple-timer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
