@sanity/ui-workshop
Version:
An environment for designing, reviewing, and quality-testing React components.
16 lines (12 loc) • 431 B
text/typescript
import {createContext} from 'react'
import {PropSchema} from './types'
/** @internal */
export interface PropsContextValue {
registerProp: (propSchema: PropSchema) => void
schemas: PropSchema[]
setPropValue: (propName: string, value: unknown) => void
unregisterProp: (propName: string) => void
value: Record<string, unknown>
}
/** @internal */
export const PropsContext = createContext<PropsContextValue | null>(null)