-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Use more ES6 syntaxes in the shopping cart example #1947
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
Conversation
return (dispatch, getState) => { | ||
const cart = getState().cart | ||
export const checkout = (products) => (dispatch, getState) => { | ||
const cart = getState().cart |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're really going this far, you might as well do const {cart} = getState()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I agree, it was a total overkill before ;)
Thanks! |
</div> | ||
) | ||
} | ||
return <div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly dislike this style. Can we please do a pass in a separate PR that ensures returned multilne JSX is always wrapped in parens? As in:
return (
<div>
...
</div>
)
and
const Stuff = () => (
<div>
...
</div>
);
export function getVisibleProducts(state) { | ||
return state.visibleIds.map(id => getProduct(state, id)) | ||
} | ||
export const getVisibleProducts = state => state.visibleIds.map(id => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the arrow body is multiline please always start the body on the next line.
Please make it like:
export const getVisibleProducts = state =>
...
or
export const getVisibleProducts = state => (
...
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the styling advices, I'll do a pass on all of my PRs to conform with the comments you made.
Convert the shopping cart example files to using fat arrows, spread operators and stateless components.
References #1800