Skip to content

Instantly share code, notes, and snippets.

@jhfgloria
Last active May 1, 2019 16:51
Show Gist options
  • Select an option

  • Save jhfgloria/0cda3d5d0e0399a55e5cf96a4b62c69f to your computer and use it in GitHub Desktop.

Select an option

Save jhfgloria/0cda3d5d0e0399a55e5cf96a4b62c69f to your computer and use it in GitHub Desktop.
class MyChildComponent extends PureComponent {
render() {
console.log('Proof that I\'m always re-rendering')
// return something to render
}
}
class MyParentComponent extends Component {
componentDidMount() {
window.setInterval(() => {
this.forceUpdate
}, 1000) // force the component to render every 1 second
}
render() {
<MyChildComponent callback={ () => { console.log('Hello World') } } />
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment