_x000D_
class Blog extends Component{_x000D_
render(){_x000D_
const posts1 = this.props.posts;_x000D_
//console.log(posts)_x000D_
const sidebar = (_x000D_
<ul>_x000D_
{posts1.map((post) => {_x000D_
//Must use return to avoid this error._x000D_
return(_x000D_
<li key={post.id}>_x000D_
{post.title} - {post.content}_x000D_
</li>_x000D_
)_x000D_
})_x000D_
}_x000D_
_x000D_
</ul>_x000D_
);_x000D_
const maincontent = this.props.posts.map((post) => {_x000D_
return(_x000D_
<div key={post.id}>_x000D_
<h3>{post.title}</h3>_x000D_
<p>{post.content}</p>_x000D_
</div>_x000D_
)_x000D_
})_x000D_
return(_x000D_
<div>{sidebar}<hr/>{maincontent}</div>_x000D_
);_x000D_
}_x000D_
}_x000D_
const posts = [_x000D_
{id: 1, title: 'Hello World', content: 'Welcome to learning React!'},_x000D_
{id: 2, title: 'Installation', content: 'You can install React from npm.'}_x000D_
];_x000D_
_x000D_
ReactDOM.render(_x000D_
<Blog posts={posts} />,_x000D_
document.getElementById('root')_x000D_
);
_x000D_