File size: 653 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Link from 'next/link'

const UnexpectedNestedA = () => {
  const UnexpectedWrapper = (props) => {
    const { href, id } = props
    const safeProps = { href, id }
    return <a {...safeProps}>{props.children}</a>
  }

  return UnexpectedWrapper
}

const FakeA = UnexpectedNestedA()

export default () => (
  <div className="nav-pass-href-prop">
    <Link href="/nav" passHref legacyBehavior>
      <FakeA id="with-href">Will redirect as an `a` tag</FakeA>
    </Link>

    <Link href="/nav" legacyBehavior>
      <FakeA id="without-href">Will not redirect as an `a` tag</FakeA>
    </Link>

    <p>This is the passHref prop page.</p>
  </div>
)