MCPcopy Create free account
hub / github.com/adobe/react-spectrum / useSyntheticLinkProps

Function useSyntheticLinkProps

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

Source from the content-addressed store, hash-verified

178}
179
180export function useSyntheticLinkProps(props: LinkDOMProps): DOMAttributes<HTMLElement> {
181 let router = useRouter();
182 // oxlint-disable-next-line react/react-compiler
183 const href = router.useHref(props.href ?? '');
184 return {
185 'data-href': props.href ? href : undefined,
186 'data-target': props.target,
187 'data-rel': props.rel,
188 'data-download': props.download,
189 'data-ping': props.ping,
190 'data-referrer-policy': props.referrerPolicy
191 } as DOMAttributes<HTMLElement>;
192}
193
194/** @deprecated - For backward compatibility. */
195export function getSyntheticLinkProps(props: LinkDOMProps): DOMAttributes<HTMLElement> {

Callers 3

useGridListItemFunction · 0.90
useTableRowFunction · 0.90
useTagFunction · 0.90

Calls 1

useRouterFunction · 0.70

Tested by

no test coverage detected