Unverified Commit c29810dc authored by Wes Bos's avatar Wes Bos Committed by GitHub

docs: Add required legacyBehavior for passHref to work (#68897)

parent 8d6f8324
...@@ -10,7 +10,7 @@ title: 'Link `passHref`' ...@@ -10,7 +10,7 @@ title: 'Link `passHref`'
## Possible Ways to Fix It ## Possible Ways to Fix It
If you're using a custom component that wraps an `<a>` tag, make sure to add `passHref`: If you're using a custom component that wraps an `<a>` tag, make sure to add `passHref` and `legacyBehavior`:
```jsx filename="nav-link.js" ```jsx filename="nav-link.js"
import Link from 'next/link' import Link from 'next/link'
...@@ -22,7 +22,7 @@ const StyledLink = styled.a` ...@@ -22,7 +22,7 @@ const StyledLink = styled.a`
function NavLink({ href, name }) { function NavLink({ href, name }) {
return ( return (
<Link href={href} passHref> <Link href={href} passHref legacyBehavior>
<StyledLink>{name}</StyledLink> <StyledLink>{name}</StyledLink>
</Link> </Link>
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment