0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/docs/framework/react/api/router/useLinkPropsHook.md
Sean Cassiere b5eabe19f5
docs: native markdown relative hyperlinks (#1998)
* docs: reference docs

* docs: guides

* docs: top-level

* docs: missed the route-trees

* docs: fixing routing-concepts
2024-07-20 18:23:45 +12:00

1.1 KiB

id title
useLinkPropsHook useLinkProps hook

The useLinkProps hook that takes an object as its argument and returns a React.AnchorHTMLAttributes<HTMLAnchorElement> props object. These props can then be safely applied to an anchor element to create a link that can be used to navigate to the new location. This includes changes to the pathname, search params, hash, and location state.

useLinkProps options

type UseLinkPropsOptions = ActiveLinkOptions &
  React.AnchorHTMLAttributes<HTMLAnchorElement>
  • ActiveLinkOptions
  • The useLinkProps options are used to build a LinkProps object.
  • It also extends the React.AnchorHTMLAttributes<HTMLAnchorElement> type, so that any additional props that are passed to the useLinkProps hook will be merged with the LinkProps object.

useLinkProps returns

  • A React.AnchorHTMLAttributes<HTMLAnchorElement> object that can be applied to an anchor element to create a link that can be used to navigate to the new location