Answer the question
In order to leave comments, you need to log in
Why does Tippy js tooltip not work with React.cloneElement?
Maybe someone came across. I'm using tippyjs. I pass children through React.cloneElement to pass the necessary props. Tippy works, but all tooltips are shown not above the elements, but positioned at the top left of the screen, without being tied to the element itself. How can this be fixed?
export default function Tooltip() {
const myRef= React.useRef(null);
return (
<Tippy>
{React.cloneElement(
React.isValidElement(children) ? (
children
) : (
<span {...props}>{children}</span>
),
{
ref: myRef,
onMouseOut: onMouseOut,
onMouseOver: onMouseOver,
className: className,
...props,
}
)}
</Tippy>
);
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question