Last active
January 5, 2019 23:29
-
-
Save jsrath/d59411e0042d7788564ab82986f0d502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filterByBrand = event => { | |
this.setState({ brand: event.target.value }, () => { | |
const filtered = this.state.items.filter(item => | |
item.manufacturer.toLowerCase() | |
.includes(this.state.brand.toLowerCase()), | |
); | |
this.setState({ filtered }); | |
}); | |
}; | |
filterByRating = event => { | |
this.setState({ rating: event.target.value.slice(0, 1) }, () => { | |
const filtered = this.state.items.filter(item => | |
item.rating >= this.state.rating); | |
this.setState({ filtered }); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment