# react-count-to

> Animated counter component for React.js

Latest version **0.12.0** (published 2018-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-count-to
pnpm add react-count-to
yarn add react-count-to
bun add react-count-to
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.12.0 |
| Published | 2018-10-31 |
| First published | 2015-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/react-count-to) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 28.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 61 |
| Author | Michele Bertoli |
| Maintainers | michelebertoli |
| Keywords | React.js, react-component |

## Links

- npm: https://www.npmjs.com/package/react-count-to
- Repository: https://github.com/MicheleBertoli/react-count-to
- Issues: https://github.com/MicheleBertoli/react-count-to/issues
- npm.io page: https://npm.io/package/react-count-to

## Dependencies (1)

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

## Recent versions

- 0.12.0 (latest) — 2018-10-31
- 0.11.0 — 2018-10-21
- 0.10.0 — 2017-11-25
- 0.9.0 — 2017-11-05
- 0.8.1 — 2017-07-08
- 0.8.0 — 2017-04-16
- 0.7.0 — 2017-03-26
- 0.6.0 — 2017-03-22
- 0.5.4 — 2016-11-14
- 0.5.3 — 2016-11-13
- 0.5.2 — 2016-11-13
- 0.5.1 — 2016-09-25
- 0.5.0 — 2016-09-25
- 0.4.2 — 2016-02-06
- 0.4.1 — 2016-02-06
- … 8 more at https://npm.io/package/react-count-to/versions

## README

[![Build Status](https://travis-ci.org/MicheleBertoli/react-count-to.svg?branch=master)](https://travis-ci.org/MicheleBertoli/react-count-to)

React Count To
==============

Animated counter  component for [React.js](http://facebook.github.io/react/)

Installation
------------

```sh
$ npm install react-count-to --save
```

Demo
----

**Live**

[http://react-count-to.herokuapp.com](http://react-count-to.herokuapp.com)

**Docker** (thanks to [Cirpo](https://github.com/cirpo))

- `docker build -t react-count-to .`
- `docker run -p 3000:3000 -it react-count-to`
- connect to [http://localhost:3000](http://localhost:3000) and enjoy

Usage
-----

```javascript
import CountTo from 'react-count-to';

<CountTo to={1234} speed={1234} />
```

or by passing function as a children
 
```javascript
import CountTo from 'react-count-to';

const fn = value => <span>{value}</span>;

<CountTo to={1234} speed={1234}>{fn}</CountTo>
```

Attributes
----------

- **from** (optional): Counting from (default: 0).
- **to**: Counting to.
- **speed**: Duration (in milliseconds).
- **delay** (optional): Delay (in milliseconds) between each refresh (default: 100).
- **onComplete** (optional): A callback triggered when counting is done.
- **digits** (optional): The number of digits to appear after the decimal point (default: 0).
- **className** (optional): HTML class attribute for counter element.
- **tagName** (optional): Element name that will be displayed (default: 'span').
- **children** (optional): Function invoked on every update with value as parameter. Must return valid React element or null.
- **easing** (optional): Function returning easing value based on input progress value from 0.0 to 1.0 (default: identity function).

Test
----

```sh
$ npm test
```

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