DEV Community

Discussion on: Creating a Countdown using React Hooks

Collapse
 
lloydinator profile image
Lloyd Miller • Edited

Thanks for this. It was great and really helpful. Might I suggest though that instead of setting the variable numbersToAddZeroTo and using multiple if statements, you instead use slice(). So for instance you can have: seconds = ('0' + seconds).slice(-2).

I think it's better this way plus if you look at the preview, you'll see that 'seconds' do not get prepended with zero. But again awesome tutorial! Very well laid out and easy to understand.