useEffect with Empty Deps
Multiple Choice Medium
Question
When does useEffect run if the dependency array is empty `[]`?
Hint
Empty array means 'no dependencies to watch'.
Explanation
An empty dependency array [] means the effect has no dependencies, so it runs only once after the initial mount. The cleanup function runs only when the component unmounts.
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.