Specify API version for studio client (Studio v2)
Both examples on this page import part:@sanity/base/client, which was removed in Studio v3 and resolves in no supported Studio. To get a client inside the Studio, use useClient({apiVersion}), or getClient({apiVersion}) outside React. See Studio React hooks.
In a previous version of the Sanity content studio, you could import a global, preconfigured Sanity client instance by importing part:@sanity/base/client.
Having a global client use a single API version is both restrictive and prevents utilizing the latest and greatest features of the Sanity API. This is why we have now deprecated using the global studio client without explicitly defining an API version to use.
Old usage:
import client from 'part:@sanity/base/client'
client.fetch('*[_type == "author"][0...10]')New usage:
import sanityClient from 'part:@sanity/base/client'
const client = sanityClient.withConfig({apiVersion: '2021-06-07'})
client.fetch('*[_type == "author"][0...10]')Details about getting your versioned client set up can be found under API Versioning and the JavaScript Client.