Redux-toolkit: How to combine this with library redux-saga-routines?

Created on 5 May 2020  路  1Comment  路  Source: reduxjs/redux-toolkit

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 const repos = action.payload;
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));

Most helpful comment

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:

https://redux-toolkit.js.org/api/createSlice#extrareducers

>All comments

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:

https://redux-toolkit.js.org/api/createSlice#extrareducers

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bassplayerch picture bassplayerch  路  3Comments

SoYoung210 picture SoYoung210  路  4Comments

cole-robertson picture cole-robertson  路  3Comments

FdezRomero picture FdezRomero  路  4Comments

amankkg picture amankkg  路  4Comments