What is the difference between using the methods below ?
I used this to update a React Component state:
changeRate(id, rate) {
  let color = this.state.colors.find((c) => c.id == id);
  color.rating = rate;
  this.setState({ color });
}
In the book i am following, this was used:
rateColor(id, rating) {
    const colors = this.state.colors.map(color =>
    (color.id !== id) ? color : { ...color, rating })
    this.setState({colors})
}
 
    