Complete useEffect Dependency Array
Fill in the Blank Medium
Question
Fill in the blank so the effect runs only once on mount.
Code
useEffect(() => {
console.log("mounted");
}, _____);
Hint
An empty array means no dependencies to watch.
Explanation
An empty dependency array [] tells React the effect has no dependencies, so it runs only once after the initial mount and never again (unless the component unmounts and remounts).
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.