Skip to content

Instantly share code, notes, and snippets.

@eyaleizenberg
Created January 22, 2018 08:42
Show Gist options
  • Save eyaleizenberg/f9bb1d927cd1d6836ae87ffcd1e433ca to your computer and use it in GitHub Desktop.
Save eyaleizenberg/f9bb1d927cd1d6836ae87ffcd1e433ca to your computer and use it in GitHub Desktop.
imdb_list final app container
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