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

add support for middleware #35

Open
conorhastings opened this issue Jan 6, 2020 · 4 comments
Open

add support for middleware #35

conorhastings opened this issue Jan 6, 2020 · 4 comments

Comments

@conorhastings
Copy link
Owner

in a perfect world it could support redux middleware

@jamesplease
Copy link
Collaborator

What do you envision the API looking like? fwiw I currently build a middleware system on top of the API that already exists

@conorhastings
Copy link
Owner Author

conorhastings commented Jan 7, 2020

3rd arg and or partial application

useReducer(middleware)(state, cb => {})

this breaks direct compat tho

or useReducer(state, cb, middleware) middleware being an array that gets run through dequentially being passed the subsequent state and returning either state or next(state)

since you have obviously have experience would love to hear your ideas

@conorhastings conorhastings changed the title add support middleware add support for middleware Jan 7, 2020
@jamesplease
Copy link
Collaborator

jamesplease commented Jan 8, 2020

That makes sense...seems good to me! The API changes that were made in #14 (aka #19 ) and #9 should make that API possible, I think.

Also, if it's useful this is the pattern I currently use: https://gist.github.com/jamesplease/ab7207cfd0f3aaf3ffd9990f8f4c8bed

@conorhastings
Copy link
Owner Author

nice, definitely useful and . similar to my brain thoughts, thanks for the commentts

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

No branches or pull requests

2 participants