Skip to content

Instantly share code, notes, and snippets.

@pmqa pmqa/App.js
Created Jan 11, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.