🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: React Basics: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. In JSX, which attribute replaces HTML's class?
  2. Q2. How should you add an item to a state array tasks?
  3. Q3. Can a child component change the props it receives?
  4. Q4. When does useEffect(fn, []) run?
  5. Q5. Why should list keys be stable ids rather than array indexes?
  6. Q6. What is a React component?
  7. Q7. What happens when you call the setter from useState, like setCount(count + 1)?
  8. Q8. What is a controlled input in React?
  9. Q9. Two sibling components need the same data. Where should the state live?
  10. Q10. Why should data fetching go inside useEffect instead of directly in the component body?