We have moved to a new website!

If you are not redirected within 3 seconds, click here to go my homepage.

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

Read More