TanStackT
TanStack2y ago
12 replies
worthy-azure

TypeError with Link component

I am using file based routing and I have a home page under "/home" and the following code in my navigation component:

import {Link} from '@tanstack/react-router'

const Nav = () => {
    return (
        <nav>
            <Link to="/home">Home</Link>
        </nav>
    )


I followed the docs but still get the following error: "Element Link doesn't have required attribute search ".

I think this might be a bug because the type for the search property is search: true | {} | ((current: {}) => {}) | undefined.
Everything is Relative

Believe it or not, every navigation within an app is relative, even if you aren't using explicit relative path syntax (../../somewhere). Any time a link is clicked or an imperative navigation call is made, you will always have an origin path and a destination path which means you are navigating from one route to another ...
Navigation | TanStack Router React Docs
Was this page helpful?