DevAcademy

React Beginner Practice

36 questions covering 12 React topics.

Quick Quiz

1. What is React?

2. Does React encourage a declarative or imperative style of UI programming?

3. Is React itself a full framework with built-in routing and data fetching?

4. Which tool is commonly recommended for quickly starting a new plain React project?

5. What does createRoot(...).render(<App />) do?

6. What is <StrictMode> used for?

7. What does JSX compile down to?

8. What is the JSX equivalent of the HTML class attribute?

9. How do you return multiple sibling elements from a component without an extra wrapping <div>?

10. What must a component’s name always start with?

11. Can a component modify the props it receives?

12. What does the special children prop contain?

13. What is the purpose of the key prop in a list?

14. Why is using the array index as a key risky?

15. Does a key value get passed down to the child component as a regular prop?

16. What does React use for conditional rendering?

17. What can go wrong with {count && <Component />} if count is 0?

18. What happens when a component returns null?

19. What is wrong with onClick={handleClick()}?

20. How do you pass an argument to an event handler in React?

21. What does event.preventDefault() commonly stop?

22. What does useState(0) return?

23. Does calling the state setter update the variable immediately?

24. Why is setUser({ ...user, age: user.age + 1 }) correct, but mutating user.age directly is not?

25. What makes an input "controlled" in React?

26. Which attribute does a controlled checkbox use instead of value?

27. Why might you use one state object instead of separate useState calls for each form field?

28. What is "prop drilling"?

29. How can a component accept more than one distinct content area, beyond just children?

30. What is one benefit of favoring composition over one large, heavily-configured component?

31. What is the main advantage of CSS Modules over plain imported CSS?

32. What type of value does the style prop expect?

33. Why are inline styles a poor fit for hover effects and media queries?

34. What problem does a Fragment solve?

35. When do you need the full <Fragment key={...}> form instead of the <>...</> shorthand?

36. Why are portals commonly used for modals?