Update Blog props

This commit is contained in:
LordMathis 2017-11-01 18:42:46 +01:00
parent bc01f94f6e
commit 4048fbbc66
2 changed files with 13 additions and 4 deletions

View File

@ -3,19 +3,27 @@ import React, {Component} from 'react';
export default class Blog extends Component { export default class Blog extends Component {
render() { render() {
if (this.props.data.isLoading) { if (this.props.isLoading) {
return ( return (
<h1>Loading</h1> <h1>Loading</h1>
); );
} }
let posts = this.props.posts.map((post) => {
return (
<div>
<div>{post.published}</div>
<div>{post.filename}</div>
</div>
)
})
return ( return (
<div> <div>
<div className="content"> <div className="content">
<h1>Blog</h1> <h1>Blog</h1>
<div>{this.props.data.posts[0].published}</div> {posts}
<div>{this.props.data.posts[0].filename}</div>
</div> </div>
</div> </div>

View File

@ -23,7 +23,8 @@ export default class BlogContainer extends Component {
render() { render() {
return ( return (
<Blog data={this.state}/> <Blog isLoading={this.state.isLoading}
posts={this.state.posts}/>
) )
} }
} }