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

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

Open kmvan opened this issue 3 years ago • 5 comments

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

kmvan avatar Dec 17 '20 03:12 kmvan

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.

alex-cory avatar Dec 17 '20 23:12 alex-cory

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

YCMitch avatar Jun 16 '21 08:06 YCMitch

Happy to accept a PR.

alex-cory avatar Jun 17 '21 19:06 alex-cory

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

YCMitch avatar Jun 18 '21 00:06 YCMitch

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

Same.

kmvan avatar Mar 19 '22 01:03 kmvan