Interview practice question
A useEffect causes an infinite loop
Frontend Engineering · React · Beginner
A component re-renders endlessly after you added a useEffect. What's likely wrong?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Effect sets state that's in its dependencies.
- Missing dependency array.
- Object/array dependencies recreated each render.
- Fix dependencies or derive value.
- Often effect isn't needed.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.