TanStackT
TanStack11mo ago
8 replies
skinny-azure

Why Route.useSearch returns any here?

Hello,

This is probably a stupid question, but I can't find my mistake.

In this route:

import { createFileRoute } from "@tanstack/react-router";
import { z } from "zod";

export const Route = createFileRoute("/toto")({
  validateSearch: () => ({
    myparam: z.string().default("mydefaultvalue"),
  }),
  component: RouteComponent,
});

function RouteComponent() {
  const data = Route.useSearch();
  console.log(">>", data);
  return <div>Hello "/toto"!</div>;
}


data is of type any. What am I missing?
Was this page helpful?