Skip to content
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

Consider using Redux 3.1 API #2

Closed
gaearon opened this issue Feb 3, 2016 · 3 comments
Closed

Consider using Redux 3.1 API #2

gaearon opened this issue Feb 3, 2016 · 3 comments
Assignees

Comments

@gaearon
Copy link

gaearon commented Feb 3, 2016

This caught my eye:

  • Easy to understand objects instead of functional composition
    • Before: compose(applyMiddleware(middleware), devtools)(createStore)(combineReducers(reducers), initialState)
    • After: createStore({middleware: [], initialState: {}, reducer: fn})

Not saying it’s perfect now, but since Redux 3.1 we allow

createStore(
  reducer,
  initialState,
  applyMiddleware(middleware)
)

or

createStore(
  reducer,
  initialState,
  compose(applyMiddleware(middleware), DevTools.instrument())
)

if you want DevTools.

Is this of any help?

@tsemerad
Copy link

tsemerad commented Feb 3, 2016

I agree with this. I don't think we need a wrapper around Redux's own createStore.

@yocontra yocontra self-assigned this Feb 3, 2016
@yocontra
Copy link
Member

yocontra commented Feb 3, 2016

Personally I still feel like it isn't clear enough. Looking at the last block of code would require most people to open the redux docs and look at the API for createStore, compose, and applyMiddleware to figure out what's going on.

I'll update the example code to redux 3.1 and make sure we use it internally, but I still think there is value in wrapping the API. 🌴

@gaearon
Copy link
Author

gaearon commented Feb 3, 2016

👍

@gaearon gaearon closed this as completed Feb 3, 2016
yocontra pushed a commit that referenced this issue Feb 3, 2016
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