react-stopwatch
A Stopwatch Component built on top of React.
Installation
First, install the component:
yarn add react-stopwatch
or
npm install react-stopwatch --save
Usage
;; const Stopwatch = <ReactStopwatch seconds=0 minutes=0 hours=0 limit="00:00:10" onChange= { // do something } onCallback= console render= { return <div> <p> Formatted: formatted </p> <p> Hours: hours </p> <p> Minutes: minutes </p> <p> Seconds: seconds </p> </div> ; } />; ;
Properties
seconds
: Integer. Needs to be between0 >= seconds <= 60
. (Required)minutes
: Integer. Needs to be between0 >= minutes <= 60
. (Required)hours
: Integer. Needs to be0 >= hours
. (Required)limit
: String. Need to have the following formatXX:XX:XX
. (Optional)withLoop
: Boolean. If it istrue
when the watch is equal tolimit
, it makes a loop. (Optional)autoStart
: Boolean. Start counting time. Default: true (Optional)onCallback
: Function. If you need to do something when the watch is equal tolimit
. (Optional)onChange
: Function. It returns the values each second. (Optional)
Made with ❤ by
- Sebastian Lorenzo (Javascript developer)
- E-mail: SebastianLorenzo@gmail.com
- StackOverflow: sebastian-lorenzo
License
MIT license. Copyright © 2018.