UNPKG

@suspensive/react-query-4

Version:

Suspensive interfaces for @tanstack/react-query@4

32 lines (29 loc) 1.08 kB
'use client'; import { _objectWithoutProperties } from "./_virtual/_@oxc-project_runtime@0.130.0/helpers/objectWithoutProperties.mjs"; import { useSuspenseQuery } from "@tanstack/react-query"; import { Fragment, jsx } from "react/jsx-runtime"; //#region src/SuspenseQuery.tsx const _excluded = ["children"]; /** * We provide these components to clearly express what causes suspense at the same depth. * `<SuspenseQuery/>` serves to make `useSuspenseQuery` easier to use in jsx. * @see {@link https://suspensive.org/docs/react-query/SuspenseQuery Suspensive Docs} * @example * ```tsx * import { SuspenseQuery } from '@suspensive/react-query' * * // You can use QueryOptions as props. * <SuspenseQuery {...queryOptions()}> * {({ data, isLoading }) => { * return <></> * } * </SuspenseQuery> * ``` */ const SuspenseQuery = (_ref) => { let { children } = _ref; return /* @__PURE__ */ jsx(Fragment, { children: children(useSuspenseQuery(_objectWithoutProperties(_ref, _excluded))) }); }; //#endregion export { SuspenseQuery }; //# sourceMappingURL=SuspenseQuery.mjs.map