I tried to combine them but it's not working?
This is my code:
slide.js
````
export const routine = createRoutine('GithubRepoForm');
const githubRepoFormSlice = createSlice({
name: 'githubRepoForm',
initialState,
reducers: {
changeUsername(state, action: PayloadAction
state.username = action.payload;
},
[routine.REQUEST]: state => {
state.loading = true;
state.error = null;
state.repositories = [];
},
[routine.SUCCESS]: (state, action: PayloadAction
state.repositories = repos;
state.loading = false;
},
[routine.FAILURE]: (state, action: PayloadAction
state.error = action.payload;
state.loading = false;
},
},
});
export const { actions, reducer, name: sliceKey } = githubRepoFormSlice;
````
saga.js: I was put actionCreator on sagas, but when I check type of actions, it's still not exist these actions which redux-saga-routines created before?
import { actions, routine } from './slice';
yield put(actions[routine.FAILURE](RepoErrorType.USERNAME_EMPTY));
Any actions that are not generated by the createSlice call need to be handled by referring to them in the extraReducers field, not the reducers field:
Most helpful comment
Any actions that are not generated by the
createSlicecall need to be handled by referring to them in theextraReducersfield, not thereducersfield:https://redux-toolkit.js.org/api/createSlice#extrareducers