Last active
July 5, 2017 17:34
-
-
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
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
# 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