3 ms·
You don't use useState to set the state, you use useState() to GET back a function that can mutate the state. And this function is safe to call in a loop or con
by littlecranky67 8y ago
You don't use useState to set the state, you use useState() to GET back a function that can mutate the state. And this function is safe to call in a loop or conditional.
When using hooks, yes, you have to remember not to call any use* function inside loops or conditionals (or use the linter plugins for that). Besides that, hardly any room for errors.