Last active
December 29, 2017 11:16
-
-
Save astrotim/01c7bc842463a8846fe367c949ff8ced to your computer and use it in GitHub Desktop.
added React Router's Link
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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