Is it possible to call a reducer function from another reducer function (within the same slice) using Redux Toolkit?
The slice object returned from createSlice includes each of the individual case reducer functions you passed in as slice.caseReducers, to help with situations like this. So, you could do: addModule(state, action) { const { moduleName, renderingData } = action.payload; if (!state.modules[moduleName]) { state.modules[moduleName] = renderingData; } WorkspacesSlice.caseReducers.setActiveModule(state, action); }, Also, reducer functions have no this, … Read more