DEV Community

Tyeb
Tyeb

Posted on

useState()

With the help of useState hook we can have state variables in a functional component. It takes an initial value as an argument and returns an array with current state value and a function to update this value.

Image description


Components are reusable pieces of code that return HTML elements.

Props are the arguments passed into a component.

State is a value that belongs to a component.

props are passed from component to component.


  • State in Class Component

  • State in Functional Component

  • Updating state in nested object

Image description

Top comments (0)