<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Portal on Commentary of Takao</title><link>https://takao.blog/en/tags/portal/</link><description>Recent content in Portal on Commentary of Takao</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>Commentary of Takao</copyright><lastBuildDate>Sat, 13 Jun 2026 23:11:50 +0900</lastBuildDate><atom:link href="https://takao.blog/en/tags/portal/index.xml" rel="self" type="application/rss+xml"/><item><title>React Portals: Advanced Patterns for Modals and Overlays</title><link>https://takao.blog/en/web/react-portal-patterns/</link><pubDate>Tue, 03 Sep 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/react-portal-patterns/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post React Portals: Advanced Patterns for Modals and Overlays" /&gt;&lt;p&gt;React portals solve a fundamental problem: DOM hierarchy constraints. A modal rendered inside a deeply nested component inherits its parent&amp;rsquo;s &lt;code&gt;z-index&lt;/code&gt; stacking context and can be clipped by &lt;code&gt;overflow: hidden&lt;/code&gt;. Portals let you render children into a different DOM node while preserving the React tree, so context, event handling, and component lifecycle all work as expected.&lt;/p&gt;
&lt;p&gt;The key insight is the separation of DOM position from React tree position. A portal&amp;rsquo;s children are physically rendered elsewhere in the DOM, but events bubble through the React component hierarchy, not the DOM hierarchy. This mental model is essential for understanding all portal patterns.&lt;/p&gt;</description></item></channel></rss>