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