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

David Gridley React Cinema #12

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

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