code:
Hello,
Is there anyway I can call startTimer from a starting of 500 milliseconds instead of 1000 milliseconds on the first call? I would like it to initialize it faster on first click but only the first time.
code:
Hello,
Is there anyway I can call startTimer from a starting of 500 milliseconds instead of 1000 milliseconds on the first call? I would like it to initialize it faster on first click but only the first time.
Your CurrentTime
component has conditional rendering of the contents (this.props.start
) and when it’s false
the strtTimer
function is called, but it takes 1000ms for it to return, so during that time nothing is displayed.
I would move all the logic to the App
component and then use some flag in the state to indicate first call.