Which hook is used to add local state to a functional component?

React Developer Easy

React Developer — Easy

Which hook is used to add local state to a functional component?

Key points

  • useState hook adds local state to functional components
  • It replaces this.state and this.setState in class components
  • useEffect is used for side effects, useContext for accessing context, and useReducer for managing more complex state
  • useState is the most common hook for managing state in React

Ready to go further?

Related questions