# use-odometer

> React custom hook for odometer (Smoothly transitions numbers with ease).

Latest version **0.0.4** (published 2019-04-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install use-odometer
pnpm add use-odometer
yarn add use-odometer
bun add use-odometer
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2019-04-02 |
| First published | 2019-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | @realdennis |
| Maintainers | realdennis |
| Keywords | react, react-hooks, odometer, smoothly-transitioning-numbers, count-up |

## Links

- npm: https://www.npmjs.com/package/use-odometer
- Repository: https://github.com/realdennis/use-odometer
- npm.io page: https://npm.io/package/use-odometer

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2

## 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.4 (latest) — 2019-04-02
- 0.0.3 — 2019-04-02
- 0.0.2 — 2019-04-02
- 0.0.1 — 2019-04-02

## README

# use-odometer
[![Build Status](https://travis-ci.org/realdennis/use-odometer.svg?branch=master)](https://travis-ci.org/realdennis/use-odometer)
[![Coverage Status](https://coveralls.io/repos/github/realdennis/use-odometer/badge.svg?branch=master)](https://coveralls.io/github/realdennis/use-odometer?branch=master)

A React custom hook for an awesome library odometer, you can use it to make your react counting app easily.

## Installation

```bash
$ yarn add use-odometer odometer
```

Remember to install **peerDependency** `odometer`.

## Usage

```jsx
const App = () => {
  const [count, setCount] = React.useState(0);
  const targetRef = React.useRef(null);
  // The ref you want to attach
  useOdometer(targetRef, count);
  return (
    <div className="App">
      <p className="target" ref={targetRef} />
      <button onClick={() => setCount(9999)}>
        {/* Just change the number state */}
        Update value
      </button>
    </div>
  );
};
```

## More

In my source code, I use default theme stylesheet, you don't need to import again.

But, if you want to use other themes (like car/digital...etc), you need to explicitly import .

eg.

```jsx
// in your components
import 'odometer/themes/odometer-theme-car.css';
//...
//...
const od = useOdometer(targetRef, value, {
  theme: 'car'
});
//...
//.. the same code
```

---

LICENSE MIT © 2019 realdennis

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