DEV Community

Discussion on: React's useEffect and useRef Explained for Mortals

Collapse
 
habelfoc profile image
Habel Justin • Edited

Oh man thanks for this!. I've been stumbled upon this problem. when i couldn't figure out why i not getting latest state from useReducer on useEffect cleanup function and ended up setting variable outside function to track my target state. Thanks again! definitely using useRef after this.

here is the example of it
codesandbox.io/s/reactjs-hook-unab...