1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-11 18:32:50 +00:00

added redux

This commit is contained in:
2016-08-18 16:10:19 +00:00
parent c572b3806d
commit 2cfda4bb4f
13 changed files with 172 additions and 65 deletions

View File

@@ -0,0 +1,30 @@
import React from 'react';
import Link from 'react-router';
export default class Preview extends React.Component{
insertPosts(posts){
let elements = [];
for (let i in posts){
elements.push(
<div key={i}>
<h1>{posts[i].title}</h1>
<p>{posts[i].date}</p>
<p>{posts[i].intro}</p>
</div>
);
}
return elements;
}
render(){
const posts = this.props.posts;
return (
<div class="Previews">
{posts.length > 0 ? this.insertPosts(posts): ""}
</div>
);
}
}