last week interviewer asked me this question. i don’t have an idea about it .anyone know?
Sure, people were doing it all the time before there were hooks, you just start the timer in a lifecycle method like componentDidMount. You do need to store the timer in state somewhere if you want to cancel the timer, which you likely want to do when the component is unmounted.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.