Skip to content

Conversation

@DavidGridley
Copy link

No description provided.

}

receiveFavouritesInfo(id, favourite) {
if (
Copy link
Contributor

Choose a reason for hiding this comment

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

The logic in this function could be simplified. If you calculate the new favourites array for each condition and store in a variable, you can then set it in state and local storage after. It will save you having to repeat setState and localStorage.setItem


receiveFavouritesInfo(id, favourite) {
if (
id === "add__to__favourites" &&
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd also say moving favourites up and down should be broken out into own functions to keep them shorter


render() {
return (
<header className="header">
Copy link
Contributor

Choose a reason for hiding this comment

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

good use of BEM

@dmitrigrabov
Copy link
Contributor

Good work. However the logic around favourites handling could be tidied up

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