Why Does State Feel Asynchronous in React? State Snapshots Explained
Understand why React state setters do not update the current render, how state snapshots work, and when to use functional state updates.

Why Does State Sometimes Feel Asynchronous in React?
You click a button, call a state setter, and immediately log the state—yet the log shows the old value. It can look as if React is updating state asynchronously. The more useful way to understand it is this: each render gets a snapshot of state, and calling a setter asks React to render again with a new snapshot.
In this lesson, we’ll see what that means in practice, how to update from the previous value safely, and why await setState(...) does not wait for a render.
A counter that surprises beginners
Here is a small counter component:
import { useState } from "react";
function Counter() {
const [count, setCount] = useState(0);
function handleClick() {
setCount(count + 1);
console.log(count);
}
return <button onClick={handleClick}>Count: {count}</button>;
}
On the first click, the button will show 1, but the log inside the click handler will show 0. That is expected. The handler is running with the count value from the render that created it. Calling setCount requests a new render; it does not rewrite the count variable inside the handler that is already running.
After React renders the component again, the next handler has a new snapshot, where count is 1.
Think of state as a render snapshot
When React renders a component, it calls your component function and gives it the current state values. The JSX and event handlers created during that render use those values. They do not change halfway through the same render or event handler.
So this sequence:
setCount(count + 1);
console.log(count);
means:
- Calculate a next value using this render’s
count. - Ask React to render again with that update.
- Continue the current handler, where
countis still the old snapshot.
The setter does not return a Promise. This does not make it wait for React to finish:
await setCount(count + 1); // Does not wait for the render
Use the state value in the next render to display updated UI. If you need to perform an effect after a particular state value has rendered, a useEffect can respond to that value:
useEffect(() => {
document.title = `Count: ${count}`;
}, [count]);
Most of the time, though, you do not need an effect just to show state. React updates the UI from the next render automatically.
When the next state depends on the previous state
The count + 1 form is fine when you are making one update based on the value currently shown. But consider calling it three times in one handler:
function handleAddThree() {
setCount(count + 1);
setCount(count + 1);
setCount(count + 1);
}
All three lines read the same count snapshot. If it is 0, each line asks for the value 1; they do not add three sequentially.
When a new value should be calculated from the previous queued value, pass an updater function:
function handleAddThree() {
setCount((previousCount) => previousCount + 1);
setCount((previousCount) => previousCount + 1);
setCount((previousCount) => previousCount + 1);
}
React applies these updater functions in order. Starting from 0, the values become 1, then 2, then 3.
The parameter name is up to you. previousCount, currentCount, or count can all work, but a descriptive name makes the relationship clear. Keep updater functions pure: calculate and return the next state, without logging, changing outside variables, or doing other side effects inside them.
A practical example: adding items to a cart
Suppose a user clicks “Add” several times quickly. Each update should use the most recently queued cart value, so use the functional form:
function addProduct(product) {
setCart((previousCart) => [...previousCart, product]);
}
This creates a new array from the previous cart and adds the product. The same pattern is useful for counters, toggles, and any update where the next value depends on the previous one.
For a toggle, for example:
setIsOpen((previousIsOpen) => !previousIsOpen);
This is safer than writing setIsOpen(!isOpen) if several updates might be queued before React renders again.
What if the handler is async?
An await does not refresh the state snapshot captured by the current handler. If work finishes later and the update depends on the latest state, use an updater:
async function handleSave() {
await saveSomething();
setCount((previousCount) => previousCount + 1);
}
The updater form is helpful because it calculates from the state React has queued by the time it processes that update. It does not mean every stale-value problem should be solved with an updater, but it is the right tool when the next state depends on the previous state.
Common misunderstanding: “React state is asynchronous”
People often use that phrase as a shortcut, but it can be misleading. A setter is not an asynchronous function that returns a Promise. It queues a state update and requests a render. The current event handler keeps seeing the snapshot it started with.
Remember these points:
- Calling a setter does not change the state variable in the current render.
- React renders again with the updated state, and the next render sees the new value.
- Use
setValue(previousValue => nextValue)when the next value depends on the previous one. - Do not expect
awaiton a setter to wait for the UI update.
Practice
Build a button labeled Add three. Start count at 0 and make one click increase it by three. First try calling setCount(count + 1) three times. Then switch to updater functions and observe the difference.
Recap
React state can feel asynchronous because the setter schedules an update while the current handler continues to use its existing render snapshot. When you need to derive the next value from the previous one, use the functional updater form. This keeps queued updates predictable and makes your intent clear.
In the next lesson, What Is State Batching in React?, we’ll look more closely at how React groups updates.
Written by
Dev Likhon
Full Stack Developer & Tech Educator
6+ years of professional development experience.
About Me
Comments
Share what you learned or ask a question.
Loading comments...