rsnext/errors/link-no-children.md
Oskar Oldorf d167ecce47
Documentation: Update link-no-children error page for new link (#46514)
The example still has an `<a>` inside the `<Link>` which was deprecated
with next 13.

Current page: https://nextjs.org/docs/messages/link-no-children

<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
-->


## Documentation / Examples

- [x] Make sure the linting passes by running `pnpm build && pnpm lint`
- [x] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2023-03-01 11:01:04 +01:00

683 B

No children were passed to

Why This Error Occurred

In your application code next/link was used without passing a child:

For example:

import Link from 'next/link'

export default function Home() {
  return (
    <>
      <Link href="/about" legacyBehavior></Link>
      // or
      <Link href="/about" legacyBehavior />
    </>
  )
}

Possible Ways to Fix It

Make sure one child is used when using <Link>:

import Link from 'next/link'

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