@vercel/microfrontends
Version:
Defines configuration and utilities for microfrontends development
34 lines (29 loc) • 1.41 kB
TypeScript
import * as react from 'react';
import react__default, { AnchorHTMLAttributes } from 'react';
import { LinkProps as LinkProps$1 } from 'next/link.js';
interface BaseProps {
children: React.ReactNode;
href: string;
}
interface NextLinkProps extends LinkProps$1 {
}
type LinkProps = BaseProps & Omit<NextLinkProps, keyof BaseProps> & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof BaseProps>;
declare function useZoneForHref(href: LinkProps['href'] | undefined): {
zoneOfHref: string | null;
isDifferentZone: boolean;
isLoading: boolean;
};
/**
* A Link component that works with microfrontend set-ups and will prefetch the
* cross zone links automatically.
*/
declare const Link: react.ForwardRefExoticComponent<BaseProps & Omit<NextLinkProps, keyof BaseProps> & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof BaseProps> & react.RefAttributes<HTMLAnchorElement>>;
interface PrefetchCrossZoneLinksContext {
prefetchHref: (href: string) => void;
}
declare const PrefetchCrossZoneLinksContext: react__default.Context<PrefetchCrossZoneLinksContext>;
declare function PrefetchCrossZoneLinksProvider({ children, }: {
children: react__default.ReactNode;
}): JSX.Element | null;
declare function PrefetchCrossZoneLinks(): JSX.Element | null;
export { Link, LinkProps, PrefetchCrossZoneLinks, PrefetchCrossZoneLinksContext, PrefetchCrossZoneLinksProvider, useZoneForHref };