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

CP Delivereat #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

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