UNPKG

@suspensive/react-query-4

Version:

Suspensive interfaces for @tanstack/react-query@4

15 lines (12 loc) 564 B
'use client'; import { Fragment, jsx } from "react/jsx-runtime"; import { useSyncExternalStore } from "react"; //#region src/components/ClientOnly.tsx const useIsClient = () => useSyncExternalStore(emptySubscribe, getSnapshot, getServerSnapshot); const emptySubscribe = () => () => {}; const getSnapshot = () => true; const getServerSnapshot = () => false; const ClientOnly = ({ children, fallback }) => /* @__PURE__ */ jsx(Fragment, { children: useIsClient() ? children : fallback }); //#endregion export { ClientOnly }; //# sourceMappingURL=ClientOnly.mjs.map