Skip to content

Instantly share code, notes, and snippets.

@Siemko
Last active Nov 6, 2017
Embed
What would you like to do?
class WorkerInfo extends React.Component {
state = { worker: null }
componentDidMount() {
// Simulate fetching data:
setTimeout(() => this.setState({
worker: `Hi, I am ${this.props.name} and I am proud to work for ${this.props.employer}`
}), 2500);
}
render() {
return this.props.children(this.state.worker);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment