Skip to content

Conversation

@chrisphillers
Copy link

No description provided.


}

fetch(){
Copy link
Contributor

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
Copy link
Contributor

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);
Copy link
Contributor

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:{}}
Copy link
Contributor

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);
Copy link
Contributor

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants