sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
21 lines (18 loc) • 462 B
text/typescript
import {type Schema} from '@sanity/types'
import {useSource} from '../studio'
/**
* React hook that returns the schema registry for the current project
*
* @public
* @returns The schema registry for the current project
* @example Using the `useSchema` hook
* ```ts
* function MyComponent() {
* const schema = useSchema()
* // ... do something with the schema ...
* }
* ```
*/
export function useSchema(): Schema {
return useSource().schema
}