Created
January 11, 2018 19:41
-
-
Save pmqa/8cec9477954f417bd7a637c790ea723c to your computer and use it in GitHub Desktop.
The App
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 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