Skip to content

Commit

Permalink
cache posts
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenGrider committed Apr 20, 2017
1 parent 8733085 commit c543e51
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion blog/src/components/posts_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class PostsIndex extends Component {
return _.map(this.props.posts, post => {
return (
<li className="list-group-item" key={post.id}>
{post.title}
<Link to={`/posts/${post.id}`}>
{post.title}
</Link>
</li>
);
});
Expand Down
2 changes: 2 additions & 0 deletions blog/src/components/posts_show.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { fetchPost } from '../actions';

class PostsShow extends Component {
Expand All @@ -17,6 +18,7 @@ class PostsShow extends Component {

return (
<div>
<Link to="/">Back To Index</Link>
<h3>{post.title}</h3>
<h6>Categories: {post.categories}</h6>
<p>{post.content}</p>
Expand Down

0 comments on commit c543e51

Please sign in to comment.