import { ReactNode } from 'react'; import PropTypes, { InferProps } from 'prop-types'; declare global { const __NEXT_DATA__: undefined | { buildId: string; }; } declare const PrefetchPropTypes: { /** * Set to true to prefetch the URL immediately when the component mounts. By default * the URL will be prefetched when the component becomes visible. */ immediately: PropTypes.Requireable; /** * The URL to prefetch. Or a function that takes the link's target URL and returns the URL to prefetch. * If omitted, this component assumes your page uses getServerSideProps and automatically derives the * URL based on next.js conventions. */ url: PropTypes.Requireable any) | null | undefined>>; /** * For use with Next.js. Do not use this prop directly. Instead specify the `passHref` prop on the parent * `` element so that Next.js passes this component the value of its `href` or `as` prop. */ href: PropTypes.Requireable; /** * Prefetch resource as: * Default: 'fetch' * https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as */ prefetchAs: PropTypes.Requireable; /** * Cross-Origin Resource Sharing option. * Possible values: false | 'anonymous' | 'use-credentials' */ cors: PropTypes.Requireable; /** * The number of seconds the item will be stored in the browser cache. * This option overrides the serviceWorkerSeconds option value from routes.js */ maxAgeSeconds: PropTypes.Requireable; /** * Set to true to send all requests to origin even when they are not in the Edge cache. * Default: false */ includeCacheMisses: PropTypes.Requireable; /** * Ratio of requests that are sent to origin even when they are not in the Edge cache. * Possible values: Number between 0 and 1. Number 0 is equal to 0% requests and 1 to 100% requests sent to origin. * Default: 0 */ forcePrefetchRatio: PropTypes.Requireable; }; interface Props extends InferProps { children?: ReactNode; prefetchAs?: string; maxAgeSeconds?: number; includeCacheMisses?: boolean; forcePrefetchRatio?: number; cors?: false | 'anonymous' | 'use-credentials'; } /** * Wrap this component around any `` or Next.js `` link element to prefetch the data for the linked page * when the link becomes visible. * * Example: * * ```js * import { Prefetch } from '@edgio/react' * * * * {product.name} * * * ``` * * When used in Next.js, this component assumes your pages use `getServerSideProps` and * automatically derives the URL to prefetch based on Next.js conventions. If you want to prefetch a * different URL, set the `url` prop. * * Example: * * ```js * import { Prefetch } from '@edgio/react' * import Link from 'next/link' * * * * {product.name} * * * ``` * * When using Next.js, take care to ensure that the anchor element either has an href prop, or the Next Link element * has the passHref prop so that the Prefetch element knows which URL to prefetch. * * You can also provide a function for the `url` prop to derive the URL to prefetch from * the link's `href`. For example: * * ```js * import { Prefetch } from '@edgio/react' * * `/api${href}`}> * {product.name} * * ``` */ declare const Prefetch: import("react").ForwardRefExoticComponent>; export default Prefetch;