Retrieves the current Sanity instance from context
The current Sanity instance
This hook accesses the nearest Sanity instance from the React context. The hook must be used within a component wrapped by a ResourceProvider or SanityApp.
ResourceProvider
SanityApp
const instance = useSanityInstance()console.log(instance.config.projectId) Copy
const instance = useSanityInstance()console.log(instance.config.projectId)
Error if no SanityInstance is found in context
Retrieves the current Sanity instance from context