Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
fix(compat): upgrade Tourism example lifecycles (#2305)
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour authored and Haroenv committed May 23, 2019
1 parent 4ad6b23 commit f896f92
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions website/examples/tourism/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,16 @@ class Range extends Component {

state = { currentValues: { min: this.props.min, max: this.props.max } };

componentWillReceiveProps(sliderState) {
// @TODO: derived state
if (sliderState.canRefine) {
componentDidUpdate(prevProps) {
if (
this.props.canRefine &&
(prevProps.currentRefinement.min !== this.props.currentRefinement.min ||
prevProps.currentRefinement.max !== this.props.currentRefinement.max)
) {
this.setState({
currentValues: {
min: sliderState.currentRefinement.min,
max: sliderState.currentRefinement.max,
min: this.props.currentRefinement.min,
max: this.props.currentRefinement.max,
},
});
}
Expand Down

0 comments on commit f896f92

Please sign in to comment.