2 ms·
The issue is more about not understanding how React works and how to use hooks. The setInterval example is easily solved. No, you can't just half-assedly guess
by bayesian_horse 5y ago
The issue is more about not understanding how React works and how to use hooks. The setInterval example is easily solved. No, you can't just half-assedly guess your way to a correct solution.
Also, composing asynchronous behavior with useEffect is also not a good idea. Don't abuse useEffect as an Event Handler (too much). Think about using Redux (+ thunks/saga) or something similar.