Skip to content

Instantly share code, notes, and snippets.

@stordahl
Last active January 20, 2021 04:02
Show Gist options
  • Save stordahl/ca9e877b1223ca1fc0182a7566c94b04 to your computer and use it in GitHub Desktop.
Save stordahl/ca9e877b1223ca1fc0182a7566c94b04 to your computer and use it in GitHub Desktop.
handy @sanity/client TypeScript module
import sanityClient from '@sanity/client';
type Client = {
projectId: string,
dataset: string,
token: string,
useCdn: boolean
}
// create instance of sanityClient
// this is how you connect your frontend to your sanity studio
const options:Client = {
//your project ID
projectId: '',
//your dataset; defaults to production
dataset: 'production',
token: '',
useCdn: true
}
const client = sanityClient( options );
export { client }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment