UNPKG

@sanity/visual-editing

Version:

[![npm stat](https://img.shields.io/npm/dm/@sanity/visual-editing.svg?style=flat-square)](https://npm-stat.com/charts.html?package=@sanity/visual-editing) [![npm version](https://img.shields.io/npm/v/@sanity/visual-editing.svg?style=flat-square)](https://

14 lines (9 loc) 292 B
import {useContext} from 'react' import {SchemaContext, type SchemaContextValue} from './SchemaContext' export function useSchema(): SchemaContextValue { const context = useContext(SchemaContext) if (!context) { throw new Error('Schema context is missing') } return context }