I followed the tutorial, and got to the last section where you put the blog posts on a page and the page ends up with just an H1 tag and none of the posts, is anyone able to take a look at the code and tell me why it might not be working?
import Link from 'next/link'
import groq from 'groq'
import client from '../client'
const Index = (props) => {
const { posts = [] } = props
return (
<div>
<h1>Welcome to a blog!</h1>
{posts.map(
({ _id, title = '', slug = '', _updatedAt = '' }) =>
slug && (
<li key={_id}>
<Link href="/post/[slug]" as={`/post/${slug.current}`}>
<a>{title}</a>
</Link>{' '}
({new Date(_updatedAt).toDateString()})
</li>
)
)}
</div>
)
}
Index.getInitialProps = async () => ({
posts: await client.fetch(groq`
*[_type == "post" && publishedAt < now()]|order(publishedAt desc)
`)
})
export default Index