@elacity-js/uikit
Version:
React / Material UI Design kit for Elacity project
15 lines (12 loc) • 381 B
JavaScript
import { useContext } from 'react';
const buildContextHook = (ContextValue, hookName, providerName) => {
return () => {
const ctx = useContext(ContextValue);
if (!ctx) {
throw new Error(`usage of ${hookName} should be within ${providerName}`);
}
return ctx;
};
};
export { buildContextHook };
//# sourceMappingURL=utils.js.map