use-reducer-with-side-effects
use-reducer-with-side-effects copied to clipboard
add support for middleware
in a perfect world it could support redux middleware
What do you envision the API looking like? fwiw I currently build a middleware system on top of the API that already exists
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
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
nice, definitely useful and . similar to my brain thoughts, thanks for the commentts