Home > other >  I found this error Warning: validateDOMNesting(...): <a> cannot appear as a descendant of <
I found this error Warning: validateDOMNesting(...): <a> cannot appear as a descendant of <

Time:01-05

I've done a react project recently. and faced this warning. could not figure out the problem. There is a screenshot attached about that warning

CodePudding user response:

The warning is telling you everything you need to know, don't put an <a> tag inside of another <a> tag.

CodePudding user response:

It's basically saying you have an <a> inside another <a>

<a>
  <a>Some link</a>
</a>

You have to find it. We will need more clue in order to help.

Wild guess, do you use react-router-dom and maybe do something like this? If yes, you can remove the inner <a>, because react-router-dom's <Link> is already an <a>

<Link to="/somepage">
  <a>Some page</a>
</Link>
  •  Tags:  
  • Related