Created
January 22, 2018 08:42
-
-
Save eyaleizenberg/f9bb1d927cd1d6836ae87ffcd1e433ca to your computer and use it in GitHub Desktop.
imdb_list final app container
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
import * as React from 'react'; | |
import { connect } from 'react-redux' | |
import App from '../components/App/App'; | |
import { selectors, actions } from '../redux/reducers'; | |
import { fetchStrangerThings } from '../actions/episodesActions'; | |
import PropTypes from 'prop-types'; | |
export class AppContainer extends React.PureComponent { | |
static propTypes = { | |
showInfoVisible: PropTypes.bool.isRequired, | |
toggleShowInfoVisible: PropTypes.func.isRequired | |
} | |
componentWillMount() { | |
this.props.fetchStrangerThings(); | |
} | |
render() { | |
return ( | |
<App { ...this.props } /> | |
); | |
} | |
} | |
const mapStateToProps = (state) => ({ | |
showInfoVisible: selectors.getShowInfoVisible(state) | |
}); | |
const { toggleShowInfoVisible } = actions; | |
export default connect(mapStateToProps, { fetchStrangerThings, toggleShowInfoVisible })(AppContainer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment