Created
May 22, 2019 17:39
-
-
Save Tiagoperes/6576899028059b668c92e250e191b706 to your computer and use it in GitHub Desktop.
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 Home extends PureComponent { | |
| componentDidMount() { | |
| const { loadCatalog } = this.props | |
| loadCatalog() | |
| } | |
| render() { | |
| const { catalog } = this.props | |
| if (isPristine(catalog)) return null | |
| if (isLoading(catalog)) return <Loading /> | |
| if (hasLoadError(catalog)) return <Error /> | |
| return <Content movies={catalog.data} /> | |
| } | |
| } | |
| const mapStateToProps = ({ catalog }) => ({ catalog }) | |
| const actions = { loadCatalog: resources.catalog.actions.load } | |
| export default connect(mapStateToProps, actions)(Home) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment