Interview Q&A / React

INTERVIEW Q&A · 58 QUESTIONS

React interview questions

Rendering, state, hooks, keys and effects, explained with small examples.

  1. What does the dependency array do in useEffect?

    It tells React when to re-run the effect. No array means after every render, an empty array means once after mount, and a list of values means after renders where one of them changed, compared with Object.is.

    BeginnerQuick answer1 min read