The State Hook

Let's learn about the useState hook and how to use it. You'll create your first React component with hooks.

We'll cover the following

Hooks are functions and officially, there are 10 of them. 10 new functions that exist to make writing and sharing functionalities in your components a lot more expressive.

useState Hook

The first hook we’ll take a look at is called useState.

For a long time, you couldn’t use the local state in a functional component. Not until hooks.

With useState, your functional component can use and update local state. How interesting!

Consider the following counter application:

With the Counter component shown below:

Get hands-on with 1200+ tech skills courses.