<div> cannot appear as a descendant of <p>. at div

Guys help me I am a beginner in JS Some one help me how to solve this error plz Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>. Image
No description
14 Replies
majkl
majkl•4mo ago
Well, you cannot have a <div> inside a paragraph. Use <span> instead, if you need.
mdrizwan0712
mdrizwan0712•4mo ago
But I not used div as a parent tag I have checked ahh
majkl
majkl•4mo ago
I haven`t seeen the code. You may have a non-closed tag somewhere.
mdrizwan0712
mdrizwan0712•4mo ago
can u tell which code i want to tell plz
No description
majkl
majkl•4mo ago
I do not know much about React but if you have that error (which I have not noticed in the first screenshot), I would assume some of the components is rendering it. I would go through the files and search for "<p" or view the compiled code, if it is available. 😄 But perhaps someone more versed in React will have a better tip.
majkl
majkl•4mo ago
Tried googling, btw? In 3 seconds I have acouple results, which look promissing. https://bobbyhadz.com/blog/warning-validatedomnesting-div-cannot-appear-as-descendant-of-p-in-react
cannot appear as a descendant of in React [Fixed] | bobbyhadz
The React.js Warning: validateDOMNesting(...): div cannot appear as a descendant of p occurs when you try to nest a div tag inside a p tag.
mdrizwan0712
mdrizwan0712•4mo ago
I replaced div with span tag the error in console gone but I didn't get the expected output
majkl
majkl•4mo ago
Replaced where? What is the resulting markup? What was the desired output? What output did you get instead? Doesn`t CSS need to be adjusted too (default <p> style is not the same as default <span>)? Much as I guessed the issue, as it seems, I am no mindreader, really.
mdrizwan0712
mdrizwan0712•4mo ago
As of now the op should come like this but I come plain
No description
mdrizwan0712
mdrizwan0712•4mo ago
In drawer side file
majkl
majkl•4mo ago
Sorry, that gives me absolutely zero idea. Hit Ctrl+U and see what markup it generates.
mdrizwan0712
mdrizwan0712•4mo ago
No description
majkl
majkl•4mo ago
HTML code in a screemshot? Seriously? Do a pen. Although I see no <span> therein. Again, what was the desired output? What output did you get instead? Doesn`t CSS need to be adjusted too (default <p> style is not the same as default <span>)? You need to look on your end.
glutonium
glutonium•4mo ago
click here it'll show u where the error came from
No description
Want results from more Discord servers?
Add your server
More Posts