I Was Writing 4 Redux Functions for Everything… Until Redux Toolkit Changed It
When I first started learning Redux, I thought this was just how things worked.
If I needed to manage a simple feature, I had to write:
- Action types
- Action creators
- Reducers
- Store configuration
At first, it felt “professional”.
But after a few days, it started to feel… repetitive.
And honestly, a bit exhausting.
The Problem With Classic Redux (From My Experience)
Let me be real.
Redux is powerful. No doubt.
But as a beginner, I kept asking myself:
Why do I need so much code just to update a simple state?
For one feature, I was jumping between multiple files:
actions.jsreducers.jsstore.js
And inside those files:
- writing constants
- writing functions
- writing switch cases
It felt like I was doing the same thing again and again.
Then I Discovered Redux Toolkit
Today, I finally spent time understanding Redux Toolkit.
And this is where everything started to change.
Redux Toolkit is basically the modern way of writing Redux.
It removes the unnecessary complexity and keeps the power.
The Moment That Changed Everything
There were two functions that completely changed my understanding:
1️⃣ configureStore
Before:
I had to manually use:
createStorecombineReducersapplyMiddleware
Now:
Just one function:
const store = configureStore({
reducer: rootReducer,
});
That’s it.
Everything is handled internally.
No extra setup.
2️⃣ createSlice
This one honestly surprised me.
Before, I had to write:
- action types
- action creators
- reducers
Separately.
Now:
const counterSlice = createSlice({
name: "counter",
initialState: { value: 0 },
reducers: {
increment(state) {
state.value++;
},
},
});
And just like that:
- actions are created automatically
- reducer is created automatically
One function replaces 3–4 things.
The Best Part: Cleaner Code
What I really liked is how clean everything feels now.
- No switch statements
- No scattered files
- No repeated boilerplate
Everything lives in one place.
And for the first time, Redux felt… simple.
A Small But Important Realization
Another thing I learned today:
You don’t have to switch everything at once.
You can use:
- classic Redux
- Redux Toolkit
in the same project
And both connect to React in the same way.
That means you can migrate step by step.
No pressure.
What I Learned Today
Today wasn’t about building something big.
It was about understanding:
How to write better Redux code.
How to reduce unnecessary complexity.
How to focus more on logic instead of boilerplate.
Final Thoughts
Before today, Redux felt like a lot of work.
After understanding Redux Toolkit, it finally started to feel practical.
If you’re learning Redux right now, my honest advice:
Don’t just learn classic Redux.
Learn Redux Toolkit early.
It will save you time, energy, and a lot of confusion.
Top comments (0)