setInterval timer with state setter

Im using a setInterval as a countdown timer and there is state being set within to display the timer. Would i need to stick this setInterval within a useEffect with a empty dependency to make sure it only runs once? Or is there a better way to do this?
2 Replies
vibbin
vibbin2y ago
Surely if the target date is static then it doesn't matter if the component gets displayed again, it will still display the correct countdown time
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server