Skip to main content

One post tagged with "state-management"

View All Tags

Why Can't I Just Use Regular Variables? Understanding useState's Magic

· 13 min read
Mahmut Salman
Software Developer

I'm a backend developer learning React, and I'm confused. Why do I need useState when I can just create my own setEmail function like we do in Java? 🤔 Just set the variable and done! My frontend mentor showed me what happens when you try this—and why React's useState is actually solving a critical problem I didn't even know existed. This conversation revealed the beautiful machinery working behind React's scenes.