'NextJS Dynamic Routing issue [duplicate]
I get this Error creating blog in NextJS. Error: Multiple children were passed to with href of / but only one child is supported
What am i doing wrong here ?
===============================
Server Error
Error: Multiple children were passed to with href of / but only one child is supported https://nextjs.org/docs/messages/link-multiple-children
This error happened while generating the page. Any console logs will be displayed in the terminal window.
<nav className={styles.main-nav}>
<ul>
<Link href='/'> <li>Home</li></Link>
<Link href='/about'> <li>About</li></Link>
<Link href='/blog'> <li>Blog</li></Link>
<Link href='/contact'> <li>Contact</li></Link>
</ul>
</nav>
Solution 1:[1]
Inside 'Link' component must be 'a' tag
<ul>
<li> <Link href='/'> <a>Home</a> </Link> </li>
<li> <Link href='/about'> <a>About</a> </Link> </li>
<li> <Link href='/blog'> <a>Blog</a> </Link> </li>
<li> <Link href='/contact'> <a>Contact</a> </Link> </li>
</ul>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Volodymyr Zelenyi |
