简体   繁体   中英

Nested Link component in Next.js 13

I have a post card, which if clicked brings you to the post's page, i also have a link inside the post card which when clicked brings you to the album of posts the post is from.

The code structure is similar to this one:

<Link href={post.url} className={styles.post}>
    ...title and stuff
    <Link href={post.groupUrl}>
        {post.group}
    </Link>
</Link>

It worked before updating to Nextjs 13

This is less of a Nextjs bug because at the end the Link component is just a fancy a tag and also gets rendered as one in the DOM. And as you can read here nesting links is illegal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM