-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 middlewareBuilder notation with type-curried arguments to co… #549
Conversation
Deploy preview for redux-starter-kit-docs ready! Built with commit 206a378 https://deploy-preview-549--redux-starter-kit-docs.netlify.app |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 206a378:
|
What's the reasoning for passing in both |
I figured it might be the most common use case to just use the default middleware and extend it like
But we can go the "only |
Yeah, I get the thought of just handing them the array, but let's assume that if they're providing a callback here that they're probably going to want to customize something, or at least that it's not too much work to have them call it here. |
Okay, I cut it down to just the |
This adds the option to pass a function instead of the middleware array as
middleware
option onconfigureStore
.This function receives a
middlewareBuilderApi
argument of the shapeEssentially that state-type-currying allows to do something like
which would before have been
Also, it is now not necessary to know the
RootState
type, which makes the use of custom middlewares possible in combination with the object-typereducer
notation in TS.(Also, while touching those files anyway, I moved the separated "3.4 tests" back into normal test suite, as we're not supporting pre-3.4 TS any more)