TanStackT
TanStack2y ago
9 replies
dry-scarlet

Link from getRouteApi

Assuming I have a getRouteApi already in scope, is there any shortcut to forming a Link to/from the route my getRouteApi is pointing to without going through a .useMatch() and using its pathname?

const pageApi = getRouteApi('...');
const Cmp = () => {
   const match = pageApi.useMatch();
   return <Link to={match.pathname}>foo</Link>
};
Was this page helpful?