alex-cory/react-useportal

`Warning: Did not expect server HTML to contain a <div> in <div>.` in nextjs React-17 ssr.

kmvan opened this issue · 5 comments

kmvan commented

Describe the bug
Warning: Did not expect server HTML to contain a <div> in <div>. in nextjs React-17 ssr.

⚠️ Make a Codesandbox ⚠️
https://codesandbox.io/s/useportal-in-nextjs-codesandbox-container-forked-oh10i?file=/pages/index.js

To Reproduce
Run the sandbox and console shows warning message.
image

Expected behavior
No warning message

I was wondering what was causing this. I will def take a look asap. Bare with me, things are kind of crazy for me right now.

Guess we never resolved this one? I'm getting it too.

Happy to accept a PR.

I just sorted it out by rendering null on the server and only rendering the portal on the client.

kmvan commented

I just sorted it out by rendering null on the server and only rendering the portal on the client.

Same.