question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning: validateDOMNesting(...): <button> cannot appear as a descendant of <button>.

See original GitHub issue

I wrapped a component that is by another component. Essentially a StyledButton within a Button.

const StyledButton = styled(Button)

Below is Console log image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
aichbauercommented, Mar 20, 2019

@aakhan89 can you give an example code? This is a warning from react itself. As I understand you do something like this:

<Button>
  <Button>text</Button>
</Button>

which is not good. Because valid html does not support buttons within buttons… so what you want is most likely to be something like:

<div>
  <Button>text</Button>
</div>
5reactions
exlntcommented, Aug 24, 2020

@aakhan89 Can you please post the root cause of your issue? I am running into the same error and I cannot find nested buttons anywhere in my code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - validateDOMNesting(...): <button> cannot appear as a ...
I'm using Material-UI in my project, I'm getting a warning in the console ...
Read more >
button cannot appear as a descendant of button
Let's say we're given the following mock from a designer to list files in rows. Alt Text. Each row should be clickable.
Read more >
Warning: validateDOMNesting(...): <button> cannot appear as ...
Warning : validateDOMNesting(...): <button> cannot appear as a descendant of <button>. in button ; Project, Ring UI Library ; Priority, Normal N ;...
Read more >
How to Prevent Nesting <button> Descendant Error in React
Everything works fine, page looks nice, but I noticed that an Error actually exists: validateDOMNesting(…): <button> cannot appear as a ...
Read more >
warning: validatedomnesting(...): <button> cannot appear as a ...
But given your requirements you can make use of a basic button with react router dom history api. A simple example: import {Link,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found