Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pmqa
Created January 11, 2018 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmqa/8cec9477954f417bd7a637c790ea723c to your computer and use it in GitHub Desktop.
Save pmqa/8cec9477954f417bd7a637c790ea723c to your computer and use it in GitHub Desktop.
The App
import React, { Component } from 'react';
import './App.css';
import State from './State';
import Posts from './components/Posts';
import { LOAD_APP } from './constants/actionTypes';
import { connect } from 'react-redux';
const mapDispatchToProps = dispatch => ({
onLoad: (payload) => {
dispatch({ type: LOAD_APP, payload })
}
});
const mapStateToProps = state => ({ ...state });
class App extends Component {
componentWillMount() {
this.props.onLoad(State);
}
render() {
return (
<Posts posts = {this.props.posts} />
);
}
}
export default connect(mapStateToProps, mapDispatchToProps)(App);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment