Implementing a countdown timer in React with Hooks
@AmirShitrit Do you mean setTimeout?Both are valid options but setTimeout suppose to trigger the function once while setInterval suppose to trigger the function every x amount of time. because of the nature of useEffect where we need to set and clear the timer every time timeLeft changes i guess it doesnt really act like a "real" setInterval and i can see your point of setTimeout in this case.
more
|