Complete Custom Hook Name
Fill in the Blank Easy
Question
Fill in the blank with a valid custom Hook name that fetches user data.
Code
function _____(userId) {
const [user, setUser] = useState(null);
useEffect(() => {
fetch(`/api/users/${userId}`).then(r => r.json()).then(setUser);
}, [userId]);
return user;
}
Hint
Custom Hooks must start with 'use'.
Explanation
Custom Hooks must start with 'use' (e.g., useUser). This naming convention is required so React's linter can enforce the Rules of Hooks and identify the function as a Hook.
Related Resources
Related Lessons
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.