🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: React Basics: all 10 questions

Quiz: React Basics · Question 4 of 10

When does useEffect(fn, []) run?

When does useEffect(fn, []) run?

  1. A.On every render
  2. B.Once, after the first render
  3. C.Never
  4. 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 →