useState

useState is a React Hook that lets you add a state variable to your component.

const [statex, setStatex] = useState(initialState)
Usage
  • Adding state to a component
  • Updating state based on the previous state
  • Updating objects and arrays in state
  • Avoiding recreating the initial state
  • Resetting state with a key
  • Storing information from previous renders