DEV Community

loading...

Discussion on: 3 React Mistakes Junior Developers Make With Component State

Collapse
kaushal18 profile image
kaushal yadav • Edited

use functions when you rely on previous state values, like toggle button, increment counter, etc. It's okay to use objects when the new state is independent of previous (like in #3). Correct me I'm wrong.

Collapse
thawkin3 profile image
Tyler Hawkins Author

Yep! That's exactly right.