I refactoring the store in my project with redux toolkit and we use also redux sagas; So I have a slice with an action:
createTask: (state: myTypeState, action:PayloadAction<myTypeState>) => {
state.createTaskStatus = status.fetching
},
In my sagas I connect the two part like that:
takeLatest(createTask().type, mySagaFunction),
In my component I use it like that with 3 parameters, needed for my saga:
dispatch(createTask({
name,
pictureFile: picture,
jobstation,
}))
But in my action I didn't use the second parameters and so I have an eslint warning:
`Unused parameter action``
How can I fix that warning?
ps: I have also try to connect toolkit and sagas like that:
export const createTaskAction = createAction(types.CREATE_TASK)
and
takeLatest(CREATE_TASK, createTask),
With that, i need to dispatch this createTaskAction and the goal is to remove as much code as possible ^^
what is the best way to do it?
This will work without Unused parameter action
:
createTask: (state: myTypeState) => { state.createTaskStatus = status.fetching },
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.