The Link component is a component that can be used to create a link that can be used to navigate to a new location. This includes changes to the pathname, search params, hash, and location state.
The Link component accepts the following props:
An anchor element that can be used to navigate to a new location.
import { Link } from '@tanstack/react-router'
function Component() {
return (
<Link
to="/somewhere/$somewhereId"
params={{ somewhereId: 'baz' }}
search={(prev) => ({ ...prev, foo: 'bar' })}
>
Click me
</Link>
)
}
import { Link } from '@tanstack/react-router'
function Component() {
return (
<Link
to="/somewhere/$somewhereId"
params={{ somewhereId: 'baz' }}
search={(prev) => ({ ...prev, foo: 'bar' })}
>
Click me
</Link>
)
}
Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.