A configured Sanity client instance
React hook that returns a configured Sanity client instance based on the given configuration. Automatically uses the correct project and dataset based on the current active workspace.
Options for the client. Specifying apiVersion is required in order to prevent breaking changes if studio changes the API version used in other places. See SourceClientOptions
A configured Sanity client instance
Deprecated
Calling
useClient()
without specifying an API version is deprecated - specify a date to prevent breaking changes, e.g.useClient({apiVersion: "2025-02-07"})
.React hook that returns a configured Sanity client instance based on the given configuration. Automatically uses the correct project and dataset based on the current active workspace.
Remarks
The client instance is automatically memoized based on API version
Example: Instantiating a client