Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

learn starter temp error : Invalid <Link> with <a>child #98

Closed
rashaabdulrazzak opened this issue Nov 1, 2022 · 4 comments
Closed

learn starter temp error : Invalid <Link> with <a>child #98

rashaabdulrazzak opened this issue Nov 1, 2022 · 4 comments

Comments

@rashaabdulrazzak
Copy link

after working through the tutorial when I arrived to
https://nextjs.org/learn/basics/assets-metadata-css/polishing-layout
when I run it I got the following error
Error: Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>. Learn more: https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor
the code for the layout has 3 places that have Link and a tag under them. I resolved it by deleting the a tag. There is another way from next docs to add legacyBehavior to the Link and give the a tag the id called link

@Thinura
Copy link

Thinura commented Nov 1, 2022

Hi @rashaabdulrazzak, I have created a PR for this issue. #99

@lgaspari
Copy link

lgaspari commented Nov 1, 2022

My guess is that both the tutorial and this repository were meant to be used with Next <13. However the dependencies were recently updated to their most up-to-date version in #97 by @delbaoliveira. IMO, I don't think it's a good idea.

I have an open PR #92 that locks the next dependency version to 12.3.1 to use one if not the latest 12 version. Thoughts? Otherwise, the tutorial would need to be updated too. It worked seamlessly for my whole tutorial.

Hi @rashaabdulrazzak, I have created a PR for this issue. #99

Hi @Thinura! Sorry, but that doesn't seem like a good solution since the idea is to get rid of nested <a> between <Link>, so you shouldn't use any wrapper underneath, see here.

@rashaabdulrazzak
Copy link
Author

@lgaspari yeah I think this is a good idea or at least the tutorial should mention the version of Next.js to use

@leerob
Copy link
Member

leerob commented Nov 4, 2022

#100

@leerob leerob closed this as completed Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants