useEffect.dev
← Back to lessons

Lesson 6Get the current state when dealing with async code

In this lesson, we’ll see how to solve one of the most common problems when using hooks: I trigger asynchronous actions in a useEffect hook, and when I want to get the current value of the state, it looks like it returns an old value instead of the latest one.