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

Function useSyntheticLinkProps

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

Source from the content-addressed store, hash-verified

161}
162
163export function useSyntheticLinkProps(props: LinkDOMProps): DOMAttributes<HTMLElement> {
164 let router = useRouter();
165 // oxlint-disable-next-line react/react-compiler
166 const href = router.useHref(props.href ?? '');
167 return {
168 'data-href': props.href ? href : undefined,
169 'data-target': props.target,
170 'data-rel': props.rel,
171 'data-download': props.download,
172 'data-ping': props.ping,
173 'data-referrer-policy': props.referrerPolicy
174 } as DOMAttributes<HTMLElement>;
175}
176
177/** @deprecated - For backward compatibility. */
178export 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