TanStackT
TanStack2y ago
2 replies
moderate-tomato

If with Outlet

Was wondering if there is a better way to do this ? Or if this would be the way to do it rn. Thanks
function TestComponent() {
  const linksQuery = useSuspenseQuery<PageLinksResponse>({ queryKey });
  const matchRoute = useMatchRoute();

  const match = matchRoute({ from: '/dashboard/test/' }) || matchRoute({ from: '/dashboard/test' });
  return (
    <>
      {match && <LinksPage data={linksQuery.data} />}
      <Outlet />
    </>
  );
}
Was this page helpful?