component state
Data a component remembers between renders, such as typed text or whether a menu is open; changing it makes React render again.
In more detail
You create state with useState or useReducer and change it only through the setter those hooks return. React stores the value on the component Fiber, not in the function, so it survives each new call of the component. State is private to the component instance and can be passed to children as props.
Related terms
- useState — The React hook that adds a state variable to a component and returns the current value with a function to change it.
- useReducer — The React hook that manages state through a reducer function, returning the current state and a dispatch function.
- state snapshot — The idea that during one render every state value is fixed, so code in that render always sees the same value even after calling a setter.
- lifting state up — Moving state from several child components into their closest common parent so they can share it.
Taught in
- Props Contract: Immutability, Children, And Polymorphic Tags — React 19 & Modern Component Architecture
- State with useState: Immutability And Asynchronous Batching — React 19 & Modern Component Architecture
- Complex State with useReducer: State Machines And Action Types — React 19 & Modern Component Architecture
- Keys In Depth: Identity Preservation And Identity Resetting — React 19 & Modern Component Architecture
- Diffing Algorithm: Element Type Shifts And Subtree Tear Down — React 19 & Modern Component Architecture
- useEffect Lifecycle: Mount, Dependencies, And Cleanup Phases — React 19 & Modern Component Architecture
- Avoiding Effect Antipatterns: Derived State And Events — React 19 & Modern Component Architecture
- Lifting State Up: Colocation, Ownership, And Data Flow — React 19 & Modern Component Architecture
- Higher-Order Components And Render Props: Tradeoff Analysis — React 19 & Modern Component Architecture
- Custom Hook Composition: Encapsulating Reactive Logic — React 19 & Modern Component Architecture