Sanity Library Reference Docs
    Preparing search index...

    Interface UseQueryOptionsUndefinedInitial

    interface UseQueryOptionsUndefinedInitial {
        initial?: undefined;
    }
    Index

    Properties

    Properties

    initial?: undefined

    Initial data and sourceMap, used with SSR hydration and is required if ssr: true and an optional speed optimization if ssr: false. It's recommended to set initial to the return value of loadQuery().

    const 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})
    }