Modern Redux with RTK

createSlice

The createSlice API simplifies reducer logic.

const counterSlice = createSlice({
  name: "counter",
  initialState,
  reducers: {
    increment(state) {
      state.value++;
    },
  },
});

It uses Immer internally to allow mutable syntax in reducers.