react-imported-component
Version:
I will import your component, and help to handle it
22 lines (21 loc) • 805 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.useIsClientPhase = void 0;
var react_1 = require("react");
var ImportedController_1 = require("../ui/ImportedController");
/**
* returns "true" if currently is a "client" phase and all features should be active
* @see {@link HydrationController}
*/
var useIsClientPhase = function () {
var value = (0, react_1.useContext)(ImportedController_1.importedState);
if (!value) {
if (process.env.NODE_ENV !== 'production') {
// tslint:disable-next-line:no-console
console.warn('react-imported-component: please wrap your entire application with ImportedController');
}
return true;
}
return value.pastHydration;
};
exports.useIsClientPhase = useIsClientPhase;
;