We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Do you want to request a feature or report a bug? feature
What is the current behavior?
function someMiddleware(opts) { return ({ dispatch, getState }) => next => action => //do stuff }
would be nice and easier to understand for those used to Node/Express/Koa to do
function someMiddleware(opts) { return ({ dispatch, getState }) => (action, next) => //do stuff & call `next()` }
Would be trivial to do and could be made backwards compatible for current middleware style by checking middleware function argument length
const [last] = chain.slice(-1); const rest = chain.slice(0, -1); const wrap = (fn, next) => { return fn.length === 2 ? (action) => fn(action, next) : fn(next); }; const newDispatch = rest.reduceRight((next, fn) => wrap(fn, next), wrap(last, store.dispatch));
Sorry if similar issues have been previously posted (I didn't find any in my search) and wondering if you'd be open to a PR?
The text was updated successfully, but these errors were encountered:
Yeah, variations on this have been discussed previously, and turned down. See #534 , #922, and #1744 for prior discussion.
Sorry, something went wrong.
😢 seems like being able to provide this API while at the same time supporting next => action through arguments check is best of both worlds ¯\_(ツ)_/¯
next => action
¯\_(ツ)_/¯
You could write your own applyMiddleware, as it's only about 20 lines of code
No branches or pull requests
Do you want to request a feature or report a bug?
feature
What is the current behavior?
would be nice and easier to understand for those used to Node/Express/Koa to do
Would be trivial to do and could be made backwards compatible for current middleware style by checking middleware function argument length
Sorry if similar issues have been previously posted (I didn't find any in my search) and wondering if you'd be open to a PR?
The text was updated successfully, but these errors were encountered: