<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>React on Commentary of Takao</title><link>https://takao.blog/en/categories/react/</link><description>Recent content in React 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/categories/react/index.xml" rel="self" type="application/rss+xml"/><item><title>Robust Frontend Exception Management with Error Boundaries</title><link>https://takao.blog/en/web/frontend-error-boundaries-logging/</link><pubDate>Tue, 20 Jan 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/frontend-error-boundaries-logging/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Robust Frontend Exception Management with Error Boundaries" /&gt;&lt;h2 id="why-error-boundaries-matter"&gt;Why Error Boundaries Matter
&lt;/h2&gt;&lt;p&gt;In React applications, a single uncaught JavaScript error in a component can crash the entire UI. Before Error Boundaries, this meant users would see a white screen with no indication of what went wrong. Error Boundaries are React components that catch JavaScript errors anywhere in their child component tree and render a fallback UI instead of crashing.&lt;/p&gt;
&lt;h2 id="implementing-an-error-boundary"&gt;Implementing an Error Boundary
&lt;/h2&gt;&lt;p&gt;Error Boundaries are class components that implement one or both of the static lifecycle methods &lt;code&gt;getDerivedStateFromError&lt;/code&gt; and &lt;code&gt;componentDidCatch&lt;/code&gt;:&lt;/p&gt;</description></item><item><title>React Compiler: Say Goodbye to Manual Memoization</title><link>https://takao.blog/en/web/react-compiler-automated-memoization/</link><pubDate>Sat, 10 Jan 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/react-compiler-automated-memoization/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post React Compiler: Say Goodbye to Manual Memoization" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;For years, React developers have manually optimized re-renders with &lt;code&gt;useMemo&lt;/code&gt;, &lt;code&gt;useCallback&lt;/code&gt;, &lt;code&gt;React.memo&lt;/code&gt;, and various state-management heuristics. The &lt;strong&gt;React Compiler&lt;/strong&gt; (formerly known as React Forget) changes this paradigm entirely. It is a build-time tool that automatically memoizes React components, hooks, and values by analyzing reactive dependencies at compile time, eliminating the need for manual optimization hooks.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="the-problem-with-manual-memoization"&gt;The Problem with Manual Memoization
&lt;/h2&gt;&lt;p&gt;Consider a typical filtered list component:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-jsx" data-lang="jsx"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;function&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;UserList&lt;/span&gt;({ &lt;span style="color:#a6e22e"&gt;users&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;filter&lt;/span&gt; }) {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;filtered&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;useMemo&lt;/span&gt;(
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; () =&amp;gt; &lt;span style="color:#a6e22e"&gt;users&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;filter&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;u&lt;/span&gt; =&amp;gt; &lt;span style="color:#a6e22e"&gt;u&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;name&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;includes&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;filter&lt;/span&gt;)),
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; [&lt;span style="color:#a6e22e"&gt;users&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;filter&lt;/span&gt;]
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; );
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;handleClick&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;useCallback&lt;/span&gt;((&lt;span style="color:#a6e22e"&gt;id&lt;/span&gt;) =&amp;gt; {
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#a6e22e"&gt;console&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;log&lt;/span&gt;(&lt;span style="color:#e6db74"&gt;&amp;#39;Clicked:&amp;#39;&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;id&lt;/span&gt;);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; }, []);
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#66d9ef"&gt;return&lt;/span&gt; (
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;ul&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; {&lt;span style="color:#a6e22e"&gt;filtered&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;map&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;user&lt;/span&gt; =&amp;gt; (
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;UserRow&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;key&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;{&lt;span style="color:#a6e22e"&gt;user&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;id&lt;/span&gt;} &lt;span style="color:#a6e22e"&gt;user&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;{&lt;span style="color:#a6e22e"&gt;user&lt;/span&gt;} &lt;span style="color:#a6e22e"&gt;onClick&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;{&lt;span style="color:#a6e22e"&gt;handleClick&lt;/span&gt;} /&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; ))}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;/&lt;span style="color:#f92672"&gt;ul&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; );
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;}
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;const&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;UserRow&lt;/span&gt; &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;React&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;memo&lt;/span&gt;(({ &lt;span style="color:#a6e22e"&gt;user&lt;/span&gt;, &lt;span style="color:#a6e22e"&gt;onClick&lt;/span&gt; }) =&amp;gt; (
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &amp;lt;&lt;span style="color:#f92672"&gt;li&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;onClick&lt;/span&gt;&lt;span style="color:#f92672"&gt;=&lt;/span&gt;{() =&amp;gt; &lt;span style="color:#a6e22e"&gt;onClick&lt;/span&gt;(&lt;span style="color:#a6e22e"&gt;user&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;id&lt;/span&gt;)}&amp;gt;{&lt;span style="color:#a6e22e"&gt;user&lt;/span&gt;.&lt;span style="color:#a6e22e"&gt;name&lt;/span&gt;}&amp;lt;/&lt;span style="color:#f92672"&gt;li&lt;/span&gt;&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;));
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This works, but it is verbose, error-prone (missing or incorrect dependency arrays), and easy to forget. A missing &lt;code&gt;useMemo&lt;/code&gt; on a large list causes unnecessary re-renders; an incorrect dependency array causes stale closures.&lt;/p&gt;</description></item><item><title>Designing Clean React Custom Hooks for Reusability</title><link>https://takao.blog/en/web/react-custom-hooks-rules/</link><pubDate>Sun, 10 Aug 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/react-custom-hooks-rules/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Designing Clean React Custom Hooks for Reusability" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;As you develop React components, you may find that files grow to hundreds of lines. This happens when &lt;code&gt;useState&lt;/code&gt;, &lt;code&gt;useEffect&lt;/code&gt;, API queries, and validation logic mix with rendering markup, making the component hard to read and maintain.&lt;/p&gt;
&lt;p&gt;This mixing of concerns makes writing unit tests difficult and increases the risk of copy-paste bugs when reusing logic across different views.&lt;/p&gt;
&lt;p&gt;The best way to separate UI (presentation) from business logic (behavior) in React is to create &lt;strong&gt;Custom Hooks&lt;/strong&gt;. This guide outlines the core design guidelines for building reusable custom hooks.&lt;/p&gt;</description></item><item><title>Stop Overusing useMemo and useCallback in React</title><link>https://takao.blog/en/web/react-hooks-usememo-usecallback/</link><pubDate>Fri, 20 Jun 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/react-hooks-usememo-usecallback/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post Stop Overusing useMemo and useCallback in React" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;When optimizing React application performance, developers often reach for &lt;strong&gt;&lt;code&gt;useMemo&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;useCallback&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;It is tempting to wrap every object and function in these hooks, assuming that caching outputs will automatically speed up the application. However, this is a common misconception.&lt;/p&gt;
&lt;p&gt;Unnecessary memoization does not just make code harder to read; it adds &lt;strong&gt;performance overhead from shallow dependency comparisons and garbage collection memory allocations&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This article outlines the specific scenarios where these hooks are beneficial and when they should be avoided.&lt;/p&gt;</description></item><item><title>React 19 Official Release and Practical Features Guide</title><link>https://takao.blog/en/web/react-19-new-features-practical/</link><pubDate>Wed, 05 Mar 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/react-19-new-features-practical/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post React 19 Official Release and Practical Features Guide" /&gt;&lt;h2 id="introduction"&gt;Introduction
&lt;/h2&gt;&lt;p&gt;React 19 represents a major paradigm shift for frontend development.&lt;/p&gt;
&lt;p&gt;Features that were previously restricted to meta-frameworks like Next.js—such as &lt;strong&gt;React Server Components (RSC)&lt;/strong&gt; and the &lt;strong&gt;Actions API&lt;/strong&gt; for form handling—are now officially integrated into the stable core React library.&lt;/p&gt;
&lt;p&gt;This guide highlights the most important features in React 19, offering practical code examples and upgrading tips to clean up your codebase.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id="1-simplification-of-async-state-with-the-actions-api"&gt;1. Simplification of Async State with the Actions API
&lt;/h2&gt;&lt;p&gt;A standout feature in React 19 is the introduction of &lt;strong&gt;Actions&lt;/strong&gt;, designed to simplify managing asynchronous mutations, loader overlays, and form submissions.&lt;/p&gt;</description></item><item><title>React Concurrent Features: Building Responsive UIs</title><link>https://takao.blog/en/web/react-concurrent/</link><pubDate>Fri, 06 Dec 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/react-concurrent/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post React Concurrent Features: Building Responsive UIs" /&gt;&lt;p&gt;React 18 introduced concurrent features that fundamentally change how rendering works. These features let React prepare multiple versions of the UI at once, interrupt work in progress, and prioritize urgent updates over non-urgent ones. The result is more responsive applications without giving up the declarative programming model that makes React productive.&lt;/p&gt;
&lt;p&gt;Concurrency in React is not an all-or-nothing mode. Unlike the abandoned &amp;ldquo;Concurrent Mode&amp;rdquo; concept from earlier experimental builds, React 18+ makes concurrent features opt-in. You adopt them feature by feature, where they provide the most value. The underlying Fiber architecture makes this possible: React&amp;rsquo;s render phase can be paused and resumed, so the reconciler can switch between different units of work as priorities change.&lt;/p&gt;</description></item><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><item><title>React State Management in 2024: Choosing the Right Tool</title><link>https://takao.blog/en/web/react-state-management-2024/</link><pubDate>Tue, 19 Mar 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/react-state-management-2024/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post React State Management in 2024: Choosing the Right Tool" /&gt;&lt;p&gt;By 2024, React&amp;rsquo;s state management landscape has matured to the point where choosing the right tool is a matter of understanding state categories rather than picking a winner. The core library provides &lt;code&gt;useState&lt;/code&gt; and &lt;code&gt;useReducer&lt;/code&gt; for local concerns, while the ecosystem offers specialized solutions for global UI state and server state. The key insight is that different categories of state benefit from different tools, and mixing them appropriately produces the most maintainable applications.&lt;/p&gt;</description></item><item><title>React Server Components: The Future of Web Rendering</title><link>https://takao.blog/en/web/react-server-components/</link><pubDate>Mon, 08 Jan 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/en/web/react-server-components/</guid><description>&lt;img src="https://takao.blog/img/thumnail.webp" alt="Featured image of post React Server Components: The Future of Web Rendering" /&gt;&lt;p&gt;React Server Components (RSC) represent a paradigm shift in how React applications render. Components run exclusively on the server, sending zero JavaScript to the client. This is not the same as Server-Side Rendering (SSR), which renders components on the server but still sends all the JavaScript for them to the client for hydration. RSC produces a special serialized format — the RSC payload — that the React reconciler on the client uses to reconstruct the component tree without executing the component code.&lt;/p&gt;</description></item></channel></rss>