9890565983
Makes sure a helpful error is shown for `<Link>` with multiple children ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. ## Documentation / Examples - [ ] Make sure the linting passes
36 lines
604 B
Markdown
36 lines
604 B
Markdown
# Multiple children were passed to <Link>
|
|
|
|
#### Why This Error Occurred
|
|
|
|
In your application code multiple children were passed to `next/link` but only one child is supported:
|
|
|
|
For example:
|
|
|
|
```js
|
|
import Link from 'next/link'
|
|
|
|
export default function Home() {
|
|
return (
|
|
<Link href="/about">
|
|
<a>To About</a>
|
|
<a>Second To About</a>
|
|
</Link>
|
|
)
|
|
}
|
|
```
|
|
|
|
#### Possible Ways to Fix It
|
|
|
|
Make sure only one child is used when using `<Link>`:
|
|
|
|
```js
|
|
import Link from 'next/link'
|
|
|
|
export default function Home() {
|
|
return (
|
|
<Link href="/about">
|
|
<a>To About</a>
|
|
</Link>
|
|
)
|
|
}
|
|
```
|