"use client"; import * as React from "react"; type UiLinkProps = Omit, "href"> & { href: string; }; type UiLinkComponent = React.ComponentType; function PlainLink({ children, ...props }: UiLinkProps) { return {children}; } // How the primitives draw an internal link. The dashboard mounts its router's // link once, in its root providers, so navigation stays client-side on every // page; the WordPress bundle keeps the plain . const UiLinkContext = React.createContext(PlainLink); function UiLinkProvider({ link, children, }: { link: UiLinkComponent; children: React.ReactNode; }) { return ( {children} ); } function useUiLink(): UiLinkComponent { return React.useContext(UiLinkContext); } /** An internal link, through the host's router. */ function UiLink(props: UiLinkProps) { const Link = useUiLink(); return ; } export { UiLink, UiLinkProvider, useUiLink }; export type { UiLinkComponent, UiLinkProps };