# use-time-react-hook

> A React hook that makes your component aware of time.

Latest version **0.0.7** (published 2020-06-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-time-react-hook
pnpm add use-time-react-hook
yarn add use-time-react-hook
bun add use-time-react-hook
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2020-06-13 |
| First published | 2020-06-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 26.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | rudyhuynh |
| Maintainers | rudyhuynh |
| Keywords | react, react-hooks, useTime, time |

## Links

- npm: https://www.npmjs.com/package/use-time-react-hook
- Repository: https://github.com/rudyhuynh/use-time-react-hook
- Homepage: https://github.com/rudyhuynh/use-time-react-hook#readme
- Issues: https://github.com/rudyhuynh/use-time-react-hook/issues
- npm.io page: https://npm.io/package/use-time-react-hook

## 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

- 0.0.7 (latest) — 2020-06-13
- 0.0.6 — 2020-06-11
- 0.0.5 — 2020-06-10
- 0.0.4 — 2020-06-10
- 0.0.1 — 2020-06-10

## README

# useTime react hook

A React hook that makes your component aware of time.

```
npm install use-time-react-hook -S
```

Or

```
yarn add use-time-react-hook
```

Examples:

- Refresh data at a latest time range:

```js
import { useTime } from "use-time-react-hook";

const App = () => {
  const [time] = useTime({ range: "last 1 minutes", interval: "1 sec" });

  useEffect(() => {
    refreshData();
  }, [time]);

  return <div>...</div>;
};
```

- Just get time: [Demo](https://rudyhuynh.github.io/use-time-react-hook/)

```js
import { useTime } from "use-time-react-hook";

const Clock = () => {
  const [time] = useTime();

  return <div> Now is ${new Date(time).toString()} </div>;
};
```

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