Skip to content

Commit

Permalink
Refactor #36
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Jul 3, 2017
1 parent c2f025a commit b96b9b9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/rating/Rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ export class Rating extends Component {
}
}

componentWillReceiveProps(nextProps) {
var newValue = nextProps.value;

if (newValue !== this.state.value) {
this.setState({value: newValue});
}
}

shouldComponentUpdate(nextProps, nextState) {
if(nextState.value === this.state.value) {
return false;
Expand Down

0 comments on commit b96b9b9

Please sign in to comment.