DEV Community

loading...

Discussion on: How to use the State Hook in React

Collapse
damcosset profile image
Damien Cosset Author

That is a very good point that I forgot to mention. Thank you very much.

This is also why I always recommend to group the values that will change at the same time together, if you want to use objects in useState. If a state variable inside an object is the only one to change in an object, while the other stays the same, I prefer to put that variable in another useState call.