chelsey lee
chelsey lee

Reputation: 180

React Material UI error <div> cannot appear as a descendant of <p>

I am trying to put a react-bootstrap carousel in each React material-UI tab. And I got the error Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>. Where should I fix?

I have copy all my codes on github, due to the length restrict of stackoverflow.

Upvotes: 0

Views: 1884

Answers (2)

amouss
amouss

Reputation: 36

I had the same problem,kept looking for root p but there was none. Then i had the idea to look up tabPanel function and inside the box there was

<Typography>{children}</Typography>

just change the tag from typography to a div or an empty div and the warning will disappear

Upvotes: 2

Agent 047
Agent 047

Reputation: 98

Try adding the attribute

component={span}

In material UI components that is nested.

Upvotes: 1

Related Questions