Skip to content
This repository was archived by the owner on Jul 7, 2021. It is now read-only.

Commit c80d63e

Browse files
committed
remove Posts component and used props to map posts for postItems variable
1 parent 9655587 commit c80d63e

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/components/Posts.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,12 @@ import { connect } from "react-redux";
33
import { fetchPosts } from "../actions/postActions";
44

55
class Posts extends Component {
6-
state = {
7-
posts: [],
8-
};
9-
106
componentDidMount() {
117
this.props.fetchPosts();
128
}
139

1410
render() {
15-
const postItems = this.state.posts.map((post) => (
11+
const postItems = this.props.posts.map((post) => (
1612
<div key={post.id}>
1713
<h3>{post.title}</h3>
1814
<p>{post.body}</p>

0 commit comments

Comments
 (0)