Closed samjmck closed 5 years ago
Not really since immer-reducer is basically just a way to define the reducer function.
This is
class Reducer extends ImmerReducer {
setName(name) {
this.draftState.name = name;
}
}
basically same as
function reducer(action, state) {
switch (action.name) {
case "SET_NAME":
return {...state, name: action.name};
default:
return state;
}
}
In theory it could be possible to make some exception for createActionCreators()
that generates thunks or something but async actions are whole new can of worms and I like that immer-reducer focuses doing only thing well.
That being said immer-reducer works well with the redux-thunk
module. I've also heard people using this with redux-observable. I personally use this thunk creating wrapper which helps with TS typing.
Ah right, I understand now. Thanks!
Was wondering if there was a way to implement asynchronous methods using thunk?