Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Vladimir-Novick/5a627fb37d5ced485cb536ff6cda4f10 to your computer and use it in GitHub Desktop.
Save Vladimir-Novick/5a627fb37d5ced485cb536ff6cda4f10 to your computer and use it in GitHub Desktop.
Currently almost all of our components implement componentWillMount
to trigger some operation in reaction to select page:
Example:
componentWillMount() {
// This method runs when the component is first added to the page
let startDateIndex = parseInt(this.props.match.params.startDateIndex) || 0;
this.props.requestTaskItems(startDateIndex);
}
My Solution:
componentWillMount() {
// Now: This method runs when the component run
// Note that the above example is very simple, startDateIndex is unique all time
var startDateIndex = new Date().getUTCMilliseconds();
this.props.requestTaskItems(startDateIndex);
this.updateDimensions();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment