question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Investigate new portals in React 16

See original GitHub issue

It would be cool if we could make this really easy and have a prop that passes down the id of a container or something similar to render <Popper/> components into.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

14reactions
jamiewindercommented, Oct 4, 2017

I’m already using react-popper with React 16’s portals:

With a simple ‘Portal’ component:

class Portal extends React.Component {
    render() {
        const { children, target = document.body } = this.props;
        return ReactDOM.createPortal(children, target);
    }
}

You can simply do:

<Manager tag={false}>
    <Target>
        <div>This target...</div>
    </Target>
    <Popper>
        <Portal>
            <div>... has this popper</div>
        </Portal>
    </Popper>
</Manager>
3reactions
fernandopasikcommented, Sep 27, 2017

Would it be possible to first update to react 16 before going into this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Investigate new portals in React 16 · Issue #58 · floating-ui ...
Investigate new portals in React 16 #58 ... I'm already using react-popper with React 16's portals: ... class Portal extends React.
Read more >
Portals - React
Portals provide a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component. ......
Read more >
Is React 16's Portal API meant to replace the Context API?
From v16.3.0 React has introduced a new context API and context is no longer experimental. Context is designed to share data that can...
Read more >
Exploring React Portals - NearForm
A dive into React Portals and exploring some common use cases. ... recent release of React v16, there are a number of exciting...
Read more >
Using a React 16 Portal to do something cool - Medium
Opens a new browser window when it mounts; Creates a 'portal' and appends props.children to the body of the new window. Isn't that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found