UNPKG

@react-three/uikit

Version:

Build performant 3D user interfaces with react-three-fiber and yoga.

11 lines (10 loc) 355 B
import { createContext, useContext } from 'react'; const ParentContext = createContext(undefined); export function useParent() { const parent = useContext(ParentContext); if (parent == null) { throw new Error(`Cannot be used outside of a uikit component.`); } return parent; } export const ParentProvider = ParentContext.Provider;