Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.39 KB

README.md

File metadata and controls

34 lines (25 loc) · 1.39 KB

How to use the Sanity Live Content API in various frameworks

These examples are intended to demonstrate how the Live Content API (LCAPI) works, and interacts with data loading and invalidation. They use @sanity/client alone. For some of these examples we deliver fully baked utils that you should use, for example Next.js 14 & 15 projects on App Router should use:

import {createClient, defineLive} from 'next-sanity'

const client = createClient({
  projectId: 'your-project-id',
  dataset: 'your-dataset',
  apiVersion: '2024-01-17',
  useCdn: true,
})

export const {sanityFetch, SanityLive} = defineLive({client})

instead of defining your own sanityFetch function and SanityLive component.

Examples that are done

TODO