AI Hints
Home›React Tutorial›Hooks Rules and TypeScript
React · Lesson 59 of 120

Hooks Quiz

Test yourself.

⏱ 2 min read▶ Video at 48:34🎓 Free
Watch this lesson in the React courseWatch on YouTube ↗Full React course

Let's review hooks. Pause after each question, and answer before I do.

  • Hooks quiz
  • Pause and think
  • Then check

Question 1

Which hook collects update logic into one function driven by actions? Use reducer.

Quick check
Actions and a reducer means:

Question 2

What must a custom hook's name start with? Use.

Quick check
A custom hook's name starts with:

Question 3

Which hook remembers the result of a slow calculation? Use memo.

Quick check
To cache a slow calculation:

Question 4

Can you call a hook inside an if statement? No. Hooks must be called at the top level.

Quick check
Hooks inside if statements are:

Summary

Well done. Next, React with TypeScript.

Key takeaways
  • useReducer
  • Custom hooks
  • Rules
Next up: React with TypeScript — typed props