UNPKG

@itwin/itwinui-react

Version:

A react component library for iTwinUI

8 lines (7 loc) 224 B
import * as React from 'react'; export const useSafeContext = (context) => { let value = React.useContext(context); if (!value) throw new Error(`${context.displayName || 'Context'} is undefined`); return value; };