UNPKG

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

12 lines (9 loc) 436 B
import {useContext} from 'react' import {ActiveWorkspaceMatcherContext} from 'sanity/_singletons' import {type ActiveWorkspaceMatcherContextValue} from './ActiveWorkspaceMatcherContext' /** @internal */ export function useActiveWorkspace(): ActiveWorkspaceMatcherContextValue { const value = useContext(ActiveWorkspaceMatcherContext) if (!value) throw new Error('Could not find `ActiveWorkspaceMatcher` context') return value }