January 14, 2019 11:22 pm GMT
Original Link: https://css-tricks.com/using-react-portals-to-render-children-outside-the-dom-hierarchy/
Using React Portals to Render Children Outside the DOM Hierarchy
Say we need to render a child element into a React application. Easy right? That child is mounted to the nearest DOM element and rendered inside of it as a result.
render() { return ( <div> // Child to render inside of the div </div> );}
But! What if we want to render that child outside of the div somewhere else? That could be tricky because it breaks the convention that a component needs to render as a new … Read article
The post Using React Portals to Render Children Outside the DOM Hierarchy appeared first on CSS-Tricks.
Original Link: https://css-tricks.com/using-react-portals-to-render-children-outside-the-dom-hierarchy/
Share this article:
Tweet
View Full Article