alex-cory/react-useportal

Docs suggestion

lukio3 opened this issue · 1 comments

Just a suggestion based upon a gotcha I encountered. When using SSR you get 'document is not defined' (since document is client side only). I modified your example to remedy this.

  const { Portal } = usePortal({
    bindTo: typeof window !== 'undefined' ? document && document.getElementById('selector') : null
  })

Thanks for the package.

Soon I'm going to do a little overhaul of this project to make it much nicer to work with. I will leave this issue in here and fix it asap