React Timer Component
A React Timer component based on a jquery based component. Displays a timer on creation and updates every second.
Check out the live Demo.
Installation
npm install timer-component
yarn add timer-component
Usage
;
Props
seconds (required)
Use seconds to declare how many seconds the timer should count for. Accepts any positive integer.
<Timer seconds=60/>
className (optional)
Use className to add a CSS class onto the component.
<Timer className="custom-class-name"/>
Pitfalls
This component does not support time intervals larger than hours or smaller than seconds (i.e. days or milliseconds).
Development
There are some scripts available in package.json.
yarn start
- to watch for file changes and update automatically with webpackyarn build
- to build the package and store in ./dist/index.js
I welcome any from of participation, so feel free to submit an issue or make a pull request.