Add support for next page to use nextein/link to load a page with posts.
elmasse opened this issue · comments
Masse Fierro commented
Use case:
Have an index page that renders a next page. Include a nextein/link
to a blog page with a list of posts.
pages/index.js
import React form 'react'
import Link from 'nextein/link'
export default () => (
<div>
<h1>Hello There</h1>
<p>This is a very simple component. With a link to <Link href="/blog"><a>My Blog</a></Link></p>
</div>
)
pages/blog.js
import React from 'react'
import withPosts from 'nextein/posts'
import { Content } from 'nextein/post'
export default withPosts(({ posts }) => {
return (
<main>
{
posts.map((post, index) => (
<article key={`post-${index}`}>
<h1>{post.data.title}</h1>
<Content {...post} />
</article>
))
}
</main>
)
})