rsnext/errors/link-multiple-children.md
Tim Neutkens 9890565983
Add helpful error for link with multiple children (#25657)
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
2021-05-31 19:41:57 +00:00

604 B

Multiple children were passed to

Why This Error Occurred

In your application code multiple children were passed to next/link but only one child is supported:

For example:

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>:

import Link from 'next/link'

export default function Home() {
  return (
    <Link href="/about">
      <a>To About</a>
    </Link>
  )
}