Document is not defined - Using React Tooltip lib with a React Static

309 Views Asked by At

I'm using a lib called react-tooltip with a framework called react-static.

But the problem is that it doesn't support SSR and I'm having some issues with it during the build time.

enter image description here

I also tried to verify the document and if it's undefined return null

  if (typeof document === "undefined") {
    return null;
  }

  return (
    <div className="inline-flex text-grey-darker">
      <span data-tip data-for={tooltipId}>
        <IconInfoSmall />
      </span>
      <ReactTooltip
        id={tooltipId}
        effect="solid"
        type="light"
        border
        borderColor="#969696"
        className={`info-tooltip ${small ? 'w-60' : 'w-90'}`}
        clickable
      >

But nothing works... Anyone had been through this problem? Was is the best approach to deal with it?

0

There are 0 best solutions below