react-use-counter
React hook for counter state.
Installation
Using npm:
$ npm install --save react-use-counter
Using yarn:
$ yarn add react-use-counter
Since this module uses React Hooks you'll need to install
at least the 16.8.0
version of react
and react-dom
:
$ yarn add react@^16.8.0 react-dom@^16.8.0
Usage
;; { const count increment = ; return <div> You clicked count times <button onClick=increment>Click me!</button> </div> ;}
API
: number void
Receives an optional initial count and returns a tuple with the current count and a function to increment the counter.
Contributing
Please feel free to submit any issues or pull requests.
License
MIT