liveBook · Manning

useState

useState is a React Hook that provides a function component with a state value and a function for updating it.

How 3 Manning books explain it

React Quickly, Second Edition

useState is a React Hook function that initializes component state and returns its current value together with a function for updating it.

How it is used
Makes functional components interactive by retaining local values and updating the displayed UI through setters.
How deep it goes
Works through initialization, destructuring, setter forms, hook ordering, and multiple states, then points to more advanced state-management approaches.
Examples
Uses a click counter, differently initialized counters, a filtered to-do list, and an email input updated from a property.
What you can do after
Build it from scratch in a functional component to initialize, display, and update local UI state.

Read how React Quickly, Second Edition explains useState →

React Hooks in Action: With Suspense and Concurrent Mode

useState is a React Hook that adds a state value and its state-updating function to a function component.

How it is used
Manages local component values and synchronizes rendered UI with user-driven state changes.
How deep it goes
Explains initialization, replacement, functional updates, object copying, multiple calls, and lifted state, without descending into React internals.
Examples
Uses BookablesList selection, group drop-downs, next-item navigation, counters, and parent-managed selected bookables.
What you can do after
Build stateful function components, update values from events, preserve prior object properties, and share state through props.

Read how React Hooks in Action: With Suspense and Concurrent Mode explains useState →

React in Depth

useState is a React hook that adds a state value and its updater function to a function component.

How it is used
Uses useState for component state in forms and as a baseline for application data distributed through context.
How deep it goes
Works through initializer inference, union and collection types, setter errors, and application-level placement, without detailing hook internals.
Examples
Uses an appointment response, a tag form, a goal tracker, and a dark-mode inspector session.
What you can do after
Apply it via React useState with explicit TypeScript types when initial values omit valid future states.

Read how React in Depth explains useState →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.