forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update next/link error when no children are provided (vercel#35453)
* Update next/link error when no children are provided * update manifest * Apply suggestions from code review Co-authored-by: Balázs Orbán <info@balazsorban.com>
- Loading branch information
1 parent
6da7691
commit 72478c5
Showing
5 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# No children were passed to <Link> | ||
|
||
#### Why This Error Occurred | ||
|
||
In your application code `next/link` was used without passing a child: | ||
|
||
For example: | ||
|
||
```js | ||
import Link from 'next/link' | ||
|
||
export default function Home() { | ||
return ( | ||
<Link href="/about"></Link> | ||
// or | ||
<Link href='/about' /> | ||
) | ||
} | ||
``` | ||
|
||
#### Possible Ways to Fix It | ||
|
||
Make sure 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> | ||
) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react' | ||
import Link from 'next/link' | ||
|
||
export default function Page() { | ||
return ( | ||
<div> | ||
Hello World. <Link href="/about"></Link> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters