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) • 406 B
text/typescript
import {useSource} from '../studio'
/**
* React hook that returns the name of the current dataset
*
* @public
* @returns The name of the current dataset
* @example Using the `useDataset` hook
* ```ts
* function MyComponent() {
* const dataset = useDataset()
* // ... do something with the dataset name ...
* }
* ```
*/
export function useDataset(): string {
return useSource().dataset
}