Hands-on practice for this lecture. Work through the exercises and quizzes to reinforce what you've learned.
Exercise 1 of 1
Six real-world scenarios. Pick the right React hook for each — useState, useEffect, useMemo, useRef, useContext, or useReducer.
Six scenarios. Pick the most appropriate hook for each.
You need a counter that shows in the UI and updates when a button is clicked.
You need to fetch user data from an API when a component mounts.
You have a list of 50,000 items and an expensive sort that should only re-run when the sort key changes.
You need to focus an input element programmatically when the user opens a modal.
A deep component tree needs access to the current theme (dark/light) without prop drilling.
A form has many related fields (name, email, role) and complex validation logic.
0/6 answered