Next.js Discord

Discord Forum

It is working in development server but not in the built

Unanswered
Pigeon tremex posted this in #help-forum
Open in Discord
Pigeon tremexOP
In the built it shows
DOMException: Node.appendChild: Cannot have more than one Element child of a Document

What sort of error is this ?

3 Replies

Nile Crocodile
According to https://react.dev/learn/synchronizing-with-effects#step-3-add-cleanup-if-needed ;
"In development React remounts every component once immediately after its initial mount".
Have you noticed this? Maybe this feature caused it to work correctly in the dev.
@aardani did you use Radix UI?
Pigeon tremexOP
😅 nono I was passing children as a prop and it caused all that, I fixed it. Lemme close this thread