T
TanStack16mo ago
metropolitan-bronze

Link params type error

I have an item component that includes an edit button that should navigate to current route + '$id'. When using the Link component and include id in params, I receive the following error:
Object literal may only specify known properties, and 'id' does not exist in type '(current: {} | { category: string; } | {} | { id: string; } | { id: string; } | { category: string; id: string; }) => never'.ts(2353)
Object literal may only specify known properties, and 'id' does not exist in type '(current: {} | { category: string; } | {} | { id: string; } | { id: string; } | { category: string; id: string; }) => never'.ts(2353)
<Link
to={`./$id/`}
params={{ id: data.id }}
>
<Link
to={`./$id/`}
params={{ id: data.id }}
>
2 Replies
continuing-cyan
continuing-cyan16mo ago
Hi. Your Link component misses the from param
metropolitan-bronze
metropolitan-bronzeOP16mo ago
Whats the best way to get the current route from within a nested component?

Did you find this page helpful?