DEV Community

Bruno Moura
Bruno Moura

Posted on

1

React, how to use useState() method

When I started the use with React, a thing that bodereds me was the method useState().

So I understood that we have two types of storage when working with React,

  • Memory storage and;
  • Component storage,

And finally, with that vision, I managed to absorbed the knowledge about the use of useState() method.

After that, I built a gif to turn my words clear,

Memory storage x Component storage

Summing up, you can change values without useState(), but what you're changing is the value in browser's memory, not in the React Component. To do that you have to use useState().

That's all folks!

Top comments (3)

Collapse
 
waiterdeveloper profile image
Anatolii

Hi Bruno ,
Have you solved a problem with object setState ?

Collapse
 
bruno8moura profile image
Bruno Moura

Hello!

Uhm...

What problem?

Collapse
 
waiterdeveloper profile image
Anatolii

Sorry,

I have seemed ,
Something went wrong

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay