UNPKG

zent

Version:

一套前端设计语言和基于React的实现

12 lines (11 loc) 410 B
import { createContext, useContext } from 'react'; export var FormChildrenContext = createContext(null); FormChildrenContext.displayName = 'ZentFormChildrenContext'; export function useFormChildrenContext() { var ctx = useContext(FormChildrenContext); if (ctx === null) { throw new Error('Component must be used under Form'); } return ctx; } export var FormContext = createContext({});