In previous archive, we established that React Elements (Blueprints) are transient they are destroyed and recreated after every single render. This creates a massive logical gap: If the object is thrown away every time, how does useState remember that count is 5?
The answer is Fiber Node. The Fiber Node represents the Current UI state (it matches what is currently on the screen and holds the state memory). The Blueprint (React Element) represents the Future UI state (it is the request for what the UI should become).
While the Blueprint is just a description (I want a div), the Fiber Node is the actual internal instance that React keeps in memory to manage that part of the UI.
Every component on your screen has a corresponding Fiber Node in memory containing these critical fields:
type: The function component itself (e.g., Button).stateNode: The link to reality (the actual DOM node).memoizedState: This is where Hooks live. It holds the current values of useState and useRef.child / sibling / return: Pointers to other fibers (forming a tree).When our component re-renders, the function runs again and local variables are wiped. But React injects the data back in from the persistent Fiber Node's
memoizedState.
This is the engine that drives the Journey from JSX to HTML.
setState. React marks the specific Fiber as dirty.div, is it now span?).stateNode (DOM), and deletes the memoizedState (memory).Deep inside the Fiber Node, memoizedState is not a simple object. It is a Linked List.
When you write this:
const [name, setName] = useState("Alice"); // Hook 1
const [age, setAge] = useState(25); // Hook 2React stores it in the Fiber like this:
Fiber.memoizedState = { value: "Alice", next: { value: 25, next: null } }
During a Re-render:
useState the first time. It looks at the Head of the linked list. Returns "Alice". Moves pointer to next.useState the second time. It looks at the Next item. Returns 25.| Feature | React Element (The Blueprint) | Fiber Node (The Engine) |
|---|---|---|
| Lifespan | Transient (Milliseconds). | Long-lived (Until unmount). |
| Mutability | Immutable. | Mutable (Props/State update). |
| Role | Description of UI. | Storage of State & DOM links. |
Why does adding a key help performance?
Because during Reconciliation, React uses the key to match the New Blueprint to the correct Existing Fiber.
Since memoizedState is a Linked List, React blindly relies on the order of calls to know which state belongs to which variable.
The Bug:
if (condition) {
useState(0); // If this doesn't run...
}
useState("Bob"); // ...React assigns the '0' state to "Bob"!If we put a Hook inside an if statement and the condition becomes false, the Linked List desyncs. React gives the wrong data to the wrong variable, and the app crashes.