react-otp-timer
You can use this component in login with otp.
Install
npm install react-otp-timer --save
Usage
Just import the component and pass the no of minutes and styles in otp component.
Component//callback of resend button{console}{let style =otpTimer:margin:'10px'color:'blue'resendBtn:backgroundColor:'#5cb85c'color:'white'border: '1 px solid #ccc'return<div><h1>Otp Timer counter</h1><Otpstyle=styleminutes=15 // Minutes ( Pass the no of minutes that you want count )resendEvent=thisresendEvent // Resend button event you can pass your function name here/></div>}
how to restart a otp-timer
There is resendEvent props which will return callback function
<Otp style={style} minutes={1.5} // Minutes ( Pass the no of minutes that you want count ) resendEvent={...} // Pass your callback function here />
Demo
You can see the demo here visit http://otptimer.surge.sh