paulwhitaker / gatsby-plugin-portal

React Portal Plugin for GatsbyJS
MIT License
5 stars 4 forks source link

Is this still the state of the art method? #2

Open bsgreenb opened 4 years ago

bsgreenb commented 4 years ago

See it hasn't been updated in 17 months, wondering if Gatsby has solved for this or if there's a new approach?

paulwhitaker commented 3 years ago

I'm sure there are other ways to do this. At the time, I just wanted a re-usable approach.

shaylavi commented 3 years ago

Pretty sure it's still is the state of the art method.. not sure if that's bad or not, but it works damn well

soyrbto commented 1 year ago

is this still the best way? It would be great to take that pr that solves the warnings

CompuWiser commented 1 year ago

You can just use

import { createPortal } from 'react-dom';

function MyComponent() {
  return (
    <div style={{ border: '2px solid black' }}>
      <p>This child is placed in the parent div.</p>
      {createPortal(
        <p>This child is placed in the document body.</p>,
        document.body
      )}
    </div>
  );
}