Skip to content

CP Delivereat#11

Open
chrisphillers wants to merge 2 commits intoconstructorlabs:masterfrom
chrisphillers:master
Open

CP Delivereat#11
chrisphillers wants to merge 2 commits intoconstructorlabs:masterfrom
chrisphillers:master

Conversation

@chrisphillers
Copy link
Copy Markdown

No description provided.

Comment thread src/components/App.js

}

fetch(){
Copy link
Copy Markdown
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

Comment thread src/components/Basket.js
if (this.props.basket[foodItem.id]) {
newBasket[foodItem.id] -= 1
} else {
newBasket[foodItem.id] = 0
Copy link
Copy Markdown
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.

Comment thread src/components/Basket.js
}

this.props.setState({ basket: newBasket }, () => {
console.log(this.props.state);
Copy link
Copy Markdown
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?

Comment thread src/components/Menu.js
class Menu extends React.Component {
constructor() {
super();
this.state = {basket:{}}
Copy link
Copy Markdown
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

Comment thread server.js
});

app.post('/api/order', function(req, res){
const order = order(req.body);
Copy link
Copy Markdown
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