@suspensive/react-query-4
Version:
Suspensive interfaces for @tanstack/react-query@4
15 lines (12 loc) • 613 B
JavaScript
'use client';
let react_jsx_runtime = require("react/jsx-runtime");
let react = require("react");
//#region src/components/ClientOnly.tsx
const useIsClient = () => (0, react.useSyncExternalStore)(emptySubscribe, getSnapshot, getServerSnapshot);
const emptySubscribe = () => () => {};
const getSnapshot = () => true;
const getServerSnapshot = () => false;
const ClientOnly = ({ children, fallback }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: useIsClient() ? children : fallback });
//#endregion
exports.ClientOnly = ClientOnly;
//# sourceMappingURL=ClientOnly.cjs.map