Course contentsShow
← React
Lesson 978 of 2,39625. Custom HooksFree lesson

Multiple Hooks of the Same Type Are Fine

You can call useState or useEffect multiple times—React tracks them by position, not type.

Multiple Hooks of the Same Type Are Fine

You'll learn: Why calling useState or useEffect multiple times in one component is perfectly normal and how React keeps them straight.

React Tracks Hooks by Position, Not Type

A common beginner worry: "I already called useState once—can I call it again?" The answer is absolutely yes! React doesn't care how many times you use the same hook type. It tracks each hook call by its position in the call order, not by what kind of hook it is.

Think of it like taking attendance by seat number, not by name. The teacher doesn't need to know your name if you always sit in seat #3—position is what matters.

Why This Works

When React renders your component, it steps through each hook call in order:

  1. First useState → React's internal slot #1
  2. Second useState → React's internal slot #2
  3. First useEffect → React's internal slot #3
  4. Third useState → React's internal slot #4

As long as these positions stay consistent between renders (which is why conditional hooks break things), React perfectly tracks each piece of state or effect independently.

The Practical Reality

Most real components use multiple hooks of the same type. You might have three pieces of state, two effects, and five custom hooks that internally use even more hooks. This is normal and expected! The "Rules of Hooks" ensure position stays stable—type repetition is not a concern.

Key Takeaway: You can call the same hook type as many times as needed in one component. React distinguishes them by call order, making multiple useState, useEffect, or custom hooks completely safe and standard practice.