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)