Replies: 9 comments 11 replies
-
I am curious about the future of |
Beta Was this translation helpful? Give feedback.
-
These props are not required to use Link, they have been deprecated, and I could not see examples that they will be required. They were kept to ensure backward compatibility as it was a breaking change, Link had an entirely different usage before, and the new usage supports all functionality that the previous one provides. Next.js Link is now a component that renders HTML |
Beta Was this translation helpful? Give feedback.
-
It would be good to replace the legacy workaround with a well-designed replacement functionality for the same use case: allow the use of a custom non-NextJS component that already renders out an How about adding a import { ExternalLink } from 'external-library'
import Link from 'next/link'
const MyLink = ({ children, href }) => {
return (
<Link as={ExternalLink} href={href}>
{children}
</Link>
)
} |
Beta Was this translation helpful? Give feedback.
-
Maybe a quick solve would be to deprecate Also found more next 15 documentation where |
Beta Was this translation helpful? Give feedback.
-
I found this discussion while researching a warning in dev mode of my 15.3 pages router app. The latest API reference for pages router still references
|
Beta Was this translation helpful? Give feedback.
-
If these are removed, what would be the proper way to inject custom attributes to a Link? Like dataset attributes for example(data-*). |
Beta Was this translation helpful? Give feedback.
-
We maintain a web component design system library. We cannot forward a Next.js The EDIT: I'll note that this suggestion above would allow us to still handle this nicely for even this use case. |
Beta Was this translation helpful? Give feedback.
-
If you wanted to have a clickable table row with Link in a table then legacy behavior is needed. |
Beta Was this translation helpful? Give feedback.
-
We have the same issue using material-ui components, and there doesn't seem to be an easy way to fix this if the import NextLink from 'next/link';
import { Button } from '@mui/material';
const ButtonLink = ({ href, ...props }) => (
<NextLink href={href} passHref legacyBehavior>
<Button {...props} />
</NextLink>
); Semantically, we can achieve the same thing by just doing Without the A solution to this would be great, either by keeping/renaming the prop or adding a new |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Next.js 15 as a major release, it's a good time to remove the legacy behavior from Next.js Link component.
It was added in Next.js 13, after two major releases, I think it makes sense to remove it.
This can:
Non-Goals
Add new features
Background
When playing with Next.js 15 canary, I found some props like
as
are no longer documented while they are kept in the implementation.I was surprised by the complexity of the implementation of the Next.js Link component, some legacy functionalities should be removed.
Proposal
legacyBehavior
propas
proppassHref
propI'm willing to provide a PR
Beta Was this translation helpful? Give feedback.
All reactions