UNPKG

f-react-use-modal

Version:
11 lines (10 loc) 363 B
"use strict"; import React from 'react'; export const useNonNullableContext = (context, name) => { const maybeContext = React.useContext(context); if (maybeContext === null || maybeContext === undefined) { throw new Error(`context "${name}" was used without a Provider`); } return maybeContext; }; //# sourceMappingURL=use-non-nullable-context.js.map