DEV Community

Bruno Moura
Bruno Moura

Posted on

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