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

Nicola's Film Search #18

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

Conversation

NicolaGibson
Copy link

No description provided.

handleClick(filmTitle) {
console.log(filmTitle);

const favouritesCopy = this.state.favouriteFilm.splice(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Splice mutates the original array by removing items from it and returning them. My guess you want to use slice here to create a copy

}

handleChange(event) {
event.preventDefault();
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than passing up events from Search to App, it would better to extract event.target.value in Search and just send up the string. It makes life slightly easier as events get dealt with in the component they are created in and only the relevant values are passed up.

}

render(){
handleSubmit(event) {
event.preventDefault();
Copy link
Contributor

Choose a reason for hiding this comment

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

as above


removeFavouriteByIndex(index) {
console.log(index);
const favouriteCopy = this.state.favouriteFilm.splice(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

As above, slice would be better here to avoid mutating the original array

@dmitrigrabov
Copy link
Contributor

Good work. Would be awesome to see more frequent commits and a README next time

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