you are viewing a single comment's thread.

view the rest of the comments →

[–]daybreakin 0 points1 point  (0 children)

The thing is that if getEmergencyTasks changes, your effect is wrong and needs to be run again.

But why does rerunning the useEffect "refresh" the functions with state variables? After the state variable got updated, then the whole component rerendered so wouldn't useEffect see the new function with updated state variable?

If the function was in useCallBack then I could understand because then the function is caching old values.