Last active
September 4, 2019 09:26
-
-
Save JakeGinnivan/81392472cf0d57bb30a5f24a70112f0f to your computer and use it in GitHub Desktop.
This file contains 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 SomethingComponent extends React.Component { | |
componentWillMount() { | |
// If we don't have an article, load it | |
if (!this.props.article) { | |
this.props.dispatch(loadArticle(this.props.id)) | |
} | |
} | |
render() { | |
if (this.props.loading) { | |
return <div>Loading...</div> | |
} | |
return <Article article={this.props.article} /> | |
} | |
} | |
// For this example, we only have a single state tree | |
// so no need to use mapStateToProps to narrow the data | |
// we are connecting to | |
export default connect(state => state)(SomethingComponent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment