MCPcopy
hub / github.com/adobe/react-spectrum / useLinkProps

Function useLinkProps

packages/react-aria/src/utils/openLink.tsx:200–212  ·  view source on GitHub ↗
(props?: LinkDOMProps)

Source from the content-addressed store, hash-verified

198}
199
200export function useLinkProps(props?: LinkDOMProps): LinkDOMProps {
201 let router = useRouter();
202 const href = router.useHref(props?.href ?? '');
203 let linkProps: LinkDOMProps = {};
204 if (props) {
205 for (let key of ['href', 'target', 'rel', 'download', 'ping', 'referrerPolicy']) {
206 if (key in props) {
207 linkProps[key] = key === 'href' ? href : props[key];
208 }
209 }
210 }
211 return linkProps;
212}
213
214export function handleLinkClick(
215 e: ReactMouseEvent,

Callers 4

useLinkFunction · 0.90
useMenuItemFunction · 0.90
useOptionFunction · 0.90
useTabFunction · 0.90

Calls 1

useRouterFunction · 0.70

Tested by

no test coverage detected