Interview practice question
State seems not to update immediately after setState
Frontend Engineering · React · Beginner
You call setCount(count + 1) and then console.log(count), but it shows the old value. Why?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- State updates are scheduled, not immediate.
- count is the value for this render.
- New value appears on next render.
- Use functional updates for successive changes.
- Use the computed value if needed now.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.