How does Redux Toolkit simplify Redux usage?
Redux Toolkit (RTK) is the official, recommended way to write Redux logic.
✅ RTK Benefits:
- Less boilerplate
- Built-in createSlice, createAsyncThunk, configureStore
- Integrated DevTools
- Handles immutability under the hood
✅ Example:
const counterSlice = createSlice({
name: 'counter',
initialState: 0,
reducers: {
increment: (state) => state + 1,
},
});
export const { increment } = counterSlice.actions;