-
Notifications
You must be signed in to change notification settings - Fork 38
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
CP Delivereat #11
base: master
Are you sure you want to change the base?
CP Delivereat #11
Conversation
|
||
} | ||
|
||
fetch(){ |
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 would give this method a more descriptive name. Fetch is a little too ambiguous
if (this.props.basket[foodItem.id]) { | ||
newBasket[foodItem.id] -= 1 | ||
} else { | ||
newBasket[foodItem.id] = 0 |
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.
it might make sense to use delete the current item from basket here rather than set quantity to 0.
} | ||
|
||
this.props.setState({ basket: newBasket }, () => { | ||
console.log(this.props.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.
did you mean this.state.basket
?
class Menu extends React.Component { | ||
constructor() { | ||
super(); | ||
this.state = {basket:{}} |
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.
Basket state appears duplicated across Menu and Basket components. It would be better to store it on place such as App
and share it using props
}); | ||
|
||
app.post('/api/order', function(req, res){ | ||
const order = order(req.body); |
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.
It looks like the order function does not exist so this is likely to break
No description provided.