UNPKG

@sanity/ui-workshop

Version:

An environment for designing, reviewing, and quality-testing React components.

15 lines (10 loc) 295 B
import {useContext} from 'react' import {PropsContext, PropsContextValue} from './PropsContext' /** @internal */ export function useProps(): PropsContextValue { const props = useContext(PropsContext) if (!props) { throw new Error('Props: missing context value') } return props }