Optional
initialconst query = `*[_type == "author" && slug.current == $slug][0]`
export const getServerSideProps = async ({params}) => {
const initial = await loadQuery<AuhthorType>(query, params)
return { props: { params, initial } }
}
export default function Page({params, initial}) {
const {data} = useQuery<AuthorType>(query, params, {initial})
}
Initial
data
andsourceMap
, used with SSR hydration and is required ifssr: true
and an optional speed optimization ifssr: false
. It's recommended to setinitial
to the return value ofloadQuery()
.