Created
July 13, 2017 06:25
-
-
Save reggie3/1b4d4b8a52ec83a0c248cfdca0506b4e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
componentWillReceiveProps(nextProps) { | |
if (nextProps.location.distanceAverage < 10) { | |
this.setState({ loopSpeed: 10 }); | |
} | |
else if (nextProps.location.distanceAverage < 100) { | |
this.setState({ loopSpeed: 100 }); | |
} | |
else if (nextProps.location.distanceAverage < 1000) { | |
this.setState({ loopSpeed: 500 }); | |
} | |
else if (nextProps.location.distanceAverage < 5000) { | |
this.setState({ loopSpeed: 1000 }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment