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
19 lines (17 loc) • 396 B
text/typescript
import {useSource} from '../studio'
/**
* React hook that returns the current project id
*
* @public
* @returns The current project id
* @example Using the `useProjectId` hook
* ```ts
* function MyComponent() {
* const projectId = useProjectId()
* // ... do something with the project id ...
* }
* ```
*/
export function useProjectId(): string {
return useSource().projectId
}