f-react-use-modal
Version:
f-react-use-modal
11 lines (10 loc) • 363 B
JavaScript
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
;