Last active
March 28, 2018 20:09
-
-
Save berzniz/949a9636b13fae0237b9587d8b8f29a4 to your computer and use it in GitHub Desktop.
Example for "Update on Async Rendering"
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
class Example extends React.Component { | |
componentDidMount () { | |
this.fetchData(this.props) | |
} | |
componentWillReceiveProps (props) { | |
if (props.id !== this.props.id) { | |
this.fetchData(props) | |
} | |
} | |
fetchData (props) { | |
... fetch and store in a Redux store ... | |
} | |
render () { ...} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment