createThunksMiddleware is typo?
yamoridon opened this issue ยท 5 comments
yamoridon commented
The equivalent of createThunksMiddleware
in redux-thunk is createThunkMiddleware
. It does not contain 's'. Is this difference intended or typo?
mjarvis commented
Ah, interesting. createThunkMiddleware
does seem to be the more correct spelling.
Suggestion for implementor: Rename the function, add a deprecated typealias for the old spelling.
DivineDominion commented
@yamoridon do you want to open a PR for this?
fbernutz commented
Hi, I hope you don't mind that I just opened a PR for this, as there was no recent activity on this. ๐
DivineDominion commented
Of course not ๐
thuongbv201118183 commented
Hello @mjarvis , I want to customize the createThunkMiddleware function. Is this possible?
I tried to call thunk.body(dispatch, getState), but the body variable was protected.
Can you give me a hand?
public func createThunkMiddleware<State>() -> Middleware<State> {
return { dispatch, getState in
return { next in
return { action in
switch action {
case let thunk as Thunk<State>:
thunk.body(dispatch, getState)
default:
next(action)
}
}
}
}
}