← Quiz: React Basics: all 10 questions
Quiz: React Basics · Question 4 of 10
When does useEffect(fn, []) run?
When does useEffect(fn, []) run?
- A.On every render
- B.Once, after the first render
- C.Never
- D.Before the component is created
Answer & explanation
Correct answer: Once, after the first render
An empty dependency array means "no dependencies change", so it runs once.
Can you get the rest right without peeking?
Take the timed Quiz: React Basics quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →