Skip to content

Add createStoreWithMiddleware function #1236

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

Closed
gajus opened this issue Jan 14, 2016 · 4 comments
Closed

Add createStoreWithMiddleware function #1236

gajus opened this issue Jan 14, 2016 · 4 comments

Comments

@gajus
Copy link
Contributor

gajus commented Jan 14, 2016

Most of the real life examples (and the official documentation) introduce an extra and unnecessary step of having to use applyMiddleware to create a function that is often named createStoreWithMiddleware (not to mention the awkward, variadic applyMiddleware syntax in the first place).

It would make sense to have a function createStoreWithMiddleware with API:

createStoreWithMiddleware(middlewares: Array<Function>, reducer, [initialState]): Object

that is equivalent to calling:

createStoreWithMiddleware = applyMiddleware(logger)(createStore);
store = createStoreWithMiddleware(todos, [ 'Use Redux' ]);
@gaearon
Copy link
Contributor

gaearon commented Jan 15, 2016

How do I add a store enhancer like Redux DevTools here?

@rossipedia
Copy link

IMO this is not the responsibility of the library. The Redux API surface is small, tight, and focused, and keeping it that way affords the most flexibility.

@gajus
Copy link
Contributor Author

gajus commented Jan 15, 2016

Agree with @rossipedia. It is indeed an unnecessary abstraction that belongs in a utility of some sort, if such is needed at all. @gaearon example further illustrates the limitations that such an abstraction introduce.

@gajus gajus closed this as completed Jan 15, 2016
@gaearon
Copy link
Contributor

gaearon commented Jan 28, 2016

I believe this is now addressed by #1294. Please let me know whether you like the solution.

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

No branches or pull requests

3 participants