alex-cory/react-useportal

SSR is failing

Closed this issue · 1 comments

entr commented

I'm building with Gatsby and I got this error.

  88 |     }, [isServer, handleOutsideMouseClick, handleKeydown, elToMountTo]);
  89 |     const Portal = react_1.useCallback(({ children }) => {
> 90 |         if (portal.current instanceof HTMLElement)
     | ^
  91 |             return react_dom_1.createPortal(children, portal.current);
  92 |         return null;
  93 |     }, []);


  WebpackError: ReferenceError: HTMLElement is not defined
  
  - usePortal.js:90 react_1.useCallback
    node_modules/react-useportal/dist/usePortal.js:90:1

I will create my portal on mount for now but I just wanted to report this.

This should be fixed in v1.0.0. The tests are passing for both server and browser. Closing this. If the problem persists, we can reopen.