Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createThunksMiddleware is typo? #20

Closed
yamoridon opened this issue Feb 28, 2019 · 5 comments · Fixed by #25
Closed

createThunksMiddleware is typo? #20

yamoridon opened this issue Feb 28, 2019 · 5 comments · Fixed by #25
Labels
good first issue Good for newcomers

Comments

@yamoridon
Copy link

The equivalent of createThunksMiddleware in redux-thunk is createThunkMiddleware. It does not contain 's'. Is this difference intended or typo?

@mjarvis mjarvis added the good first issue Good for newcomers label Feb 28, 2019
@mjarvis
Copy link
Member

mjarvis commented Feb 28, 2019

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
Copy link
Contributor

@yamoridon do you want to open a PR for this?

@fbernutz
Copy link
Contributor

Hi, I hope you don't mind that I just opened a PR for this, as there was no recent activity on this. 🙂

@DivineDominion
Copy link
Contributor

Of course not 🙌

@thuongbv201118183
Copy link

thuongbv201118183 commented Jan 13, 2022

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)
                }
            }
        }
    }
}


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants