lottie-react icon indicating copy to clipboard operation
lottie-react copied to clipboard

Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>. Error Component Stack

Open eriknyk opened this issue 11 months ago • 1 comments
trafficstars

Describe the bug I got the following Warn:

Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>. Error Component Stack

Exactly when <Lottie component is rendered.

image

To Reproduce Steps to reproduce the behavior:

  1. Render any lottie json
  2. See warning: Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>. Error Component Stack

Expected behavior No warning should be in console.

Screenshots image

Additional context Using version: "lottie-react": "^2.4.0",

eriknyk avatar Nov 28 '24 22:11 eriknyk

AlertDialogDescription is likely a <p> element, and in your screenshot we see a <div> added as a child of it. This is what the error reports, it's not about the Lottie component inside of it.

If this is a radix component, just add the asChild prop to it, or move the div and Lottie outside of the description. If this is something else, sorry your code sample isn't enough for me to help you.

Sheraff avatar Apr 27 '25 16:04 Sheraff