Redux Toolkit Not Updating State as Expected

clock icon

7 months ago Asked

message

0 Answers

eye

29 Views

I'm using Redux Toolkit in my React.js application, and I have a reducer like this:

import { createSlice } from '@reduxjs/toolkit';

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

export const { increment } = counterSlice.actions;
export default counterSlice.reducer;

0 Answer

Write your answer here

Top Questions