React Interval Timer
React Component Wrapper for setTimeout and setInterval.
npm install --save react-interval-timer
Usage examples
; Component { return <div> <IntervalTimer timeout=1000 callback={console} enabled=true repeat=true /> </div> } ;
Run the example app
git clone https://github.com/m-ueta/react-interval-timer.gitcd react-interval-timernpm installnpm start
then open http://localhost:3000
Options
Props
IntervalTimerpropTypes = timeout: PropTypesnumber enabled: PropTypesbool callback: PropTypesfunc repeat: PropTypesbool;IntervalTimerdefaultProps = timeout: 1000 enabled: false { console } repeat: true;
timeout
setTimeout setInterval time
callback
callback function
enabled
Switch timer enable or disable
repeat
switch using setInterval or setTimeout
License
MIT