import React, { Component } from 'react';

class PostsIndex extends Component {
  render() {
    return (
      <div>
        Posts Index
      </div>
    );
  }
}

export default PostsIndex;
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { fetchPosts } from '../actions';

class PostsIndex extends Component {
  componentDidMount() {
    this.props.fetchPosts();
  }
  
  render() {
    return (
      <div>
        Posts Index
      </div>
    );
  }
}

export default connect(null, { fetchPosts })(PostsIndex);


Connect fetchPosts action creator to PostsIndex
Connect fetchPosts action creator to PostsIndex
