DEV Community

Cover image for Why So Many Ways to Manage State in React? 🤔
Ogundare Toluwase Enoch
Ogundare Toluwase Enoch

Posted on

Why So Many Ways to Manage State in React? 🤔

Last year, when I started React, I entered the world of state management.

At first, it was simple.

I used props:

It felt so smooth to just pass data around — until it started becoming overwhelming.

Then I discovered useState:

Wow! A hook that could manage state directly. I thought, “This is it! I’ve mastered state management.”

But React wasn’t done with me.

Soon, I met useContext:

I still remember my reaction that day:
“React, can’t you just focus on one and let me continue my thing?” 😂

Then came useReducer:

It introduced structure, but at the same time I was like:
“Just kill me React!!!”

And finally, I reached Redux, the one I kept hearing about everywhere:

A central storage for handling complex applications.

Looking back, I thank God for the progress 🙏.

Yes, they’re all about state management. But each has its limitations, and each comes into play as apps (and developers) grow.

That opened my eyes to a bigger lesson:

➡️ The way we manage our state in life last year may not be enough for this year.

➡️ Growth brings more complexity, more responsibility… and sometimes, more stress.

But with the Lord, it becomes ease.

Someone once told me:

“When you are succeeding, running, and pushing — it’s race. But when God is beside you — it’s grace.”

Today, even though I’m not yet where I expect to be, when I look back at previous years and how I managed “state” in life then versus now, I see it’s been God’s grace all along. ✨

🔥 Props → useState → useContext → useReducer → Redux

💡 React taught me state management. God is teaching me life management.

👉 How about you? Which state management tool gave you the biggest “aha” or “stress” moment when learning React?

Top comments (0)