Skip to content

Instantly share code, notes, and snippets.

@zverbatim
Last active July 5, 2017 17:34
Show Gist options
  • Save zverbatim/7a0b7ced4041c72527c175066989a408 to your computer and use it in GitHub Desktop.
Save zverbatim/7a0b7ced4041c72527c175066989a408 to your computer and use it in GitHub Desktop.
Get the status of of smtg based of and id by running a function passed as props
# Project: https://github.com/reactjs/react-timer-mixin
class Status extends Component {
constructor(props) {
super(props);
this.state = {
status: '...'
};
}
componentDidMount() {
TimerMixin.setTimeout(
() => this.props.getStatus(this.props.id),
5000
);
}
render() {
return (<span>status: {this.state.status}</span>)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment