-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
Confusing API for creating a Redux store #664
Comments
+1 |
This is basic functional composition. |
We should first fix #632 as suggested in #632 (comment), then it'll be normal If you have a specific API to propose, please do. |
Maybe a crash course on functional programming might be helpful? Usage is probably a lot more clear if you're familiar with functional concepts. There is no configuration with redux (e.g., no Express |
Actually, how about elevating store enhancers to their own section in the docs, right before middleware? That way you introduce the concept of them, followed by an implementation. They are a fairly important concept to grok. |
Absolutely! Anything that can be linked to in the Redux documentation to bring people up to speed on the functional concepts should be. I've found the following resources very helpful so far: http://www.pluralsight.com/courses/hardcore-functional-programming-javascript |
I totally agree that a crash course on functional programming would be very nice and helpful. Aside from that I wonder if it would be feasible to have a "simpler" way to create a store, configuration object style: import { create } from 'redux'
const = create({
middlewares: [
thunkMiddleware,
loggerMiddleware
],
reducers: {
users: usersReducer,
orders: ordersReducer,
}
}) Not sure how Otherwise it would be nice if the docs and examples try to stick with one style of doing things e.g. using |
@sporto That is a pure functional programming anti-pattern. You don't use configuration to construct your store, you use composition. In that way, you aren't limited to solely the mechanisms thought out ahead of time. As you said, where does By using higher order functions and functional composition (which is still declarative, by the way), redux doesn't have to concern itself with things like that. redux-devtools can hook in simply by adding itself to the chain of execution when the store is constructed. |
I'm compelled to close this, as there have been no specific API proposal that would work with middleware, devtools, etc. |
This is now addressed by #1294. Please let me know whether it solves the problem. |
Here are some example on how to create a redux store. From the readme:
From http://rackt.github.io/redux/docs/advanced/Middleware.html
From https://github.com/gaearon/redux-devtools
So sometimes you use
createStore
, sometimescreateStoreWithMiddleware
, sometimescompose
.I have to say that this is quite confusing. I understand that there is a lot of flexibility here but it will be nicer if there could be only one canonical way to build the final store, e.g. I I don't need any middleware then I just pass an empty array.
Please consider this
The text was updated successfully, but these errors were encountered: