TanStackT
TanStack11mo ago
4 replies
hurt-tomato

useParams returns any

Hi everyone,
export const Route = createFileRoute("/myRoute/$id")({
  component: MyComponent,
});

function MyComponent() {
  const { id } = Route.useParams();
  ...
}


TypeScript: Unsafe assignment of an 'any' value

Do you know why this is happening? I tried tweaking the configuration, read through the useParams docs, and got nothing. Additionally, I remember that in other projects the returned parameter was of type string. What could be going on?
Was this page helpful?