Skip to content
Permalink
5e979ec20c
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
41 lines (36 sloc) 772 Bytes
import React from 'react';
import { Col, Row } from 'antd';
import DogCard from './dogcard';
class BlogGrid extends React.Component {
constructor(props) {
super(props);
this.state = {
posts: []
}
}
componentDidMount() {
this.setState({
posts: require('../data/dogs.json')
})
}
render() {
if (!this.state.posts.length) {
return <h3>Loading posts...</h3>
}
const cardList = this.state.posts.map(post => {
return (
<div style={{padding:"10px"}} key={post.id}>
<Col span={6}>
<DogCard {...post} />
</Col>
</div>
)
});
return (
<Row type="flex" justify="space-around">
{cardList}
</Row>
);
}
}
export default BlogGrid;