import type { RouterLinkProps, RouterLinkResolved } from '@esmx/router'; /** * Hook to create reactive link helpers for custom navigation components. * Returns a resolved link object with attributes, state, and event handlers. * * This hook is useful when you need to build custom link components * with full control over rendering while retaining router functionality. * * @param props - RouterLink properties * @returns Resolved link object with attributes, state, and navigation methods * * @example * ```tsx * import { useLink } from '@esmx/router-react'; * * function CustomNavButton({ to, children }) { * const link = useLink({ to, type: 'push', exact: 'include' }); * * return ( * * ); * } * ``` * * @example * ```tsx * // Building a custom navigation card * import { useLink } from '@esmx/router-react'; * * interface NavCardProps { * to: string; * title: string; * description: string; * icon: React.ReactNode; * } * * function NavCard({ to, title, description, icon }: NavCardProps) { * const link = useLink({ to }); * * return ( *
{description}
* {link.isExternal && ↗} *
* isActive: {String(link.isActive)}
* isExactActive: {String(link.isExactActive)}
* isExternal: {String(link.isExternal)}
* type: {link.type}
* tag: {link.tag}
*
*