Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactglobal state Zustand ReduxSingle-choice MCQ

In Redux Toolkit, you write a reducer with createSlice that does `state.items.push(action.payload)`. Why is mutating state directly safe here?

const slice = createSlice({ name: 'cart', initialState: { items: [] }, reducers: { add(state, action) { state.items.push(action.payload); }, }, });