Skip to content

Instantly share code, notes, and snippets.

@Siemko
Last active November 6, 2017 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Siemko/0adebb67c5f8ae154f79b77a76d4835a to your computer and use it in GitHub Desktop.
Save Siemko/0adebb67c5f8ae154f79b77a76d4835a to your computer and use it in GitHub Desktop.
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