UNPKG

@croquet/react

Version:

React bindings for Croquet

9 lines (8 loc) 295 B
import { useContext } from 'react'; import { CroquetContext } from '../components/CroquetContext'; export function useCroquetContext() { const contextValue = useContext(CroquetContext); if (!contextValue) throw new Error('Not inside Croquet context'); return contextValue; }