use-odometer
A React custom hook for an awesome library odometer, you can use it to make your react counting app easily.
Installation
$ yarn add use-odometer odometer
Remember to install peerDependency odometer
.
Usage
const App = const count setCount = React; const targetRef = React; // The ref you want to attach ; return <div ="App"> <p ="target" = /> <button => /* 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.
// in your componentsimport 'odometer/themes/odometer-theme-car.css';//...//...const od = ;//...//.. the same code
LICENSE MIT © 2019 realdennis