Skip to content

Instantly share code, notes, and snippets.

@astrotim
Last active December 29, 2017 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astrotim/01c7bc842463a8846fe367c949ff8ced to your computer and use it in GitHub Desktop.
Save astrotim/01c7bc842463a8846fe367c949ff8ced to your computer and use it in GitHub Desktop.
added React Router's Link
import React from 'react';
+import { Link } from 'react-router-dom';
import { createClient } from 'contentful';
class Home extends React.Component {
return this.state.posts.map(post => {
console.log(post);
- return <p>Post</p>;
+ return (
+ <Link key={post.sys.id} to={`post/${post.sys.id}/`}>
+ {post.fields.title}
+ </Link>
+ );
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment