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

Warning: Prop `dangerouslySetInnerHTML` did not match.

Open audn opened this issue 3 years ago • 12 comments

Hey!

This code,

   <ReactTooltip
      effect="solid"
      place="bottom"
      delayShow={200}
      arrowColor="transparent"
      backgroundColor="#1d2c3e"
      id="newApp"
   >
      <h1 className="text-sm text-white font-medium">Upload</h1>
   </ReactTooltip>

Seems to be giving me this: image

I've tried to use <p> tags instead of <h1> and so on, but I can't seem to get rid of it. I do indeed have custom CSS on it, and it looks like this:

.__react_component_tooltip {
  border-radius: 5px !important;
  border: 1px solid #273552 !important;
  background: #404f6d !important;
  padding: 10px 15px !important;
  color: #b7c4dc !important;
  z-index: 100 !important;
}

audn avatar Feb 21 '21 14:02 audn

Same for me. It works, but I got this warning even if any option is passed.

pmdpaula avatar Feb 23 '21 14:02 pmdpaula

"Glad" to see that I'm not the only one!

I've googled around, but I couldn't find any posts on it. Seems like theres a lot of open issues in this repo as well.

audn avatar Feb 23 '21 15:02 audn

This solution helped me. https://stackoverflow.com/questions/64079321/react-tooltip-and-next-js-ssr-issue

lipgartdmitriy avatar Feb 24 '21 17:02 lipgartdmitriy

This solution helped me. https://stackoverflow.com/questions/64079321/react-tooltip-and-next-js-ssr-issue

Thanks. It works for me. I use useEffect, bur I'll try the react-tidy package too.

pmdpaula avatar Feb 25 '21 14:02 pmdpaula

I can't seem to solve it, would you mind sharing your code here so I can try it out? @lipgartdmitriy

audn avatar Mar 15 '21 05:03 audn

I was having same problems with Next.js. I just imported component dynamically, with SSR disabled and it works.

import dynamic from "next/dynamic";

const ReactTooltip = dynamic(() => import("react-tooltip"), {
  ssr: false,
});

LeonSkrilec avatar Apr 22 '21 14:04 LeonSkrilec

Actually, @LeonSkrilec 's answer is correct, but what if the project won't based on next.js?

The good and native pure solution can be this SO link

amerllica avatar Sep 08 '21 15:09 amerllica

same issue.

bonesoul avatar Jan 17 '22 11:01 bonesoul

@LeonSkrilec thanks you saved me 😃!!

hmmhmmhm avatar Feb 18 '22 08:02 hmmhmmhm

In case you are using any server-side rendering (like Next.js) - you will need to make sure your component is mounted first before showing the react-tooltip. I fixed this by using the following:

You should wrap your JSX in the following component:

import React, { useEffect, useState } from 'react';

const NoSsr = ({ children }): JSX.Element => { const [isMounted, setMount] = useState(false);

useEffect(() => { setMount(true); }, []);

return <>{isMounted ? children : null}</>; };

export default NoSsr; Like this:

Oskku avatar Mar 14 '22 14:03 Oskku

This worked for me.

vhpoet avatar Apr 12 '22 04:04 vhpoet

Thanks Its works, cheers! @LeonSkrilec

ozdemircibaris avatar Jul 19 '22 09:07 ozdemircibaris