-
Notifications
You must be signed in to change notification settings - Fork 17
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
base: master
Are you sure you want to change the base?
Added Readme #3
Conversation
…recipes searched for
const stockArray = currentStock ? JSON.parse(currentStock) : []; | ||
const currentFaves = window.localStorage.getItem('favourites') | ||
const favesArray = currentFaves ? JSON.parse(currentFaves) : []; | ||
this.setState({ |
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.
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({ |
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.
nice
} | ||
|
||
removeItem(ingredient, property){ | ||
let newList; |
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.
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({ |
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.
nice
Great work |
tweaked readme
No description provided.