TanStackT
TanStackโ€ข2y agoโ€ข
20 replies
verbal-lime

Why Route.id is undefined?

Hey ๐Ÿ‘‹๐Ÿฝ ,
I'm sure following has worked with a version released last week. With the current version it does not work

import {
  createFileRoute,
  getRouteApi,
} from "@tanstack/react-router";

export const Route = createFileRoute("/app/component")({
  component: MyComponent,
});

console.log("Route.id", Route.id); // with current version Route.id returns undefined, I would expect "/app/component"
const routeApi = getRouteApi(Route.id);

function MyComponent() {
  const navigate = routeApi.useNavigate();
}


If I do console.log(Route), I get an output, where I can see the
id
-prop. But accessing it, results in
undefined
. Can sombody help?

Thanks
Was this page helpful?