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

Added Readme #3

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

Added Readme #3

wants to merge 19 commits into from

Conversation

DanGRT
Copy link

@DanGRT DanGRT commented Oct 7, 2018

No description provided.

const stockArray = currentStock ? JSON.parse(currentStock) : [];
const currentFaves = window.localStorage.getItem('favourites')
const favesArray = currentFaves ? JSON.parse(currentFaves) : [];
this.setState({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor point, if you rename stockArray to stock and favesArray to faves you can shorten setState call to

this.setState({stock, favourites});

}

retrievePage(page){
this.setState({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

}

removeItem(ingredient, property){
let newList;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since ternaries return a value, it would be better to perform a single assignment using the output

    const newList = property !== 'favourites'
      ?  this.state[property].filter(item => item.key !== ingredient.key)
      :  this.state[property].filter(item => item.recipe.uri !== ingredient.recipe.uri)

fetchRecipes(page = 0){
const searchString = this.state.activeIngredients.map(item => item.ingredient)
.join(",")
this.setState({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@dmitrigrabov
Copy link
Contributor

Great work

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.

None yet

2 participants