What is useState in React and how does it work?

Updated May 6, 2026

Short answer

useState is a React Hook used to add and manage state in functional components.

Deep explanation

useState allows functional components to preserve values between renders. When state updates, React triggers a re-render of the component. It returns a state value and a setter function.

Real-world example

Used in counters, form inputs, toggles, and UI interactions like modals.

Common mistakes

  • Directly mutating state instead of using the setter function.

Follow-up questions

  • Why should state updates be treated as asynchronous?
  • What happens if you update state multiple times in one function?

More React Hooks interview questions

View all →