<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Daishi Kato&#39;s blog</title>
    <link>https://blog.axlight.com/</link>
    <description>Recent content on Daishi Kato&#39;s blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 18 Oct 2025 01:00:00 +0900</lastBuildDate>
    <atom:link href="https://blog.axlight.com/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>My React Talks to Date in Various Formats</title>
      <link>https://blog.axlight.com/posts/my-react-talks-to-date-in-various-formats/</link>
      <pubDate>Sat, 18 Oct 2025 01:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/my-react-talks-to-date-in-various-formats/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;As it turns out, there are quite a few talks I&amp;rsquo;ve done so far,&#xA;and even for me, it&amp;rsquo;s hard to remember all of them.&#xA;Although it&amp;rsquo;s a bit embarrassing to see some old talks of mine,&#xA;I decided to gather them here.&lt;/p&gt;&#xA;&lt;p&gt;The following is ordered from the latest session back to the earliest.&lt;/p&gt;&#xA;&lt;h3 id=&#34;livestream-nick-taylor---2025&#34;&gt;Livestream: Nick Taylor - 2025&lt;/h3&gt;&#xA;&lt;p&gt;How Waku, the Minimal React Framework Came to Be&lt;/p&gt;</description>
    </item>
    <item>
      <title>Thoughts on State Management Libraries in the React Compiler Era</title>
      <link>https://blog.axlight.com/posts/thoughts-on-state-management-libraries-in-the-react-compiler-era/</link>
      <pubDate>Tue, 07 Jan 2025 22:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/thoughts-on-state-management-libraries-in-the-react-compiler-era/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve been developing three React state management libraries: Zustand, Jotai, and Valtio. So, how are they going to hold up in the new era with the React Compiler and React Server Components (RSCs)? This post shares my random thoughts on the topic.&lt;/p&gt;&#xA;&lt;h2 id=&#34;what-are-state-management-libraries&#34;&gt;What are state management libraries?&lt;/h2&gt;&#xA;&lt;p&gt;State management libraries manage the state of your application. For my libraries specifically, the primary goal isn&amp;rsquo;t just about how the state is managed. This ties into why there are three libraries. They differ in how they deal with states (for example, immutable, atomic, proxy, etc.) and how developers manage their states.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Thoughts on What RSC Means for SPAs</title>
      <link>https://blog.axlight.com/posts/thoughts-on-what-rsc-means-for-spas/</link>
      <pubDate>Tue, 26 Nov 2024 21:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/thoughts-on-what-rsc-means-for-spas/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;RSC stands for React Server Component, but in this post, I’ll use RSC to refer to a broader architecture consisting of two key aspects:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;The core feature, which is the ability to serialize and deserialize React components and other values, and&lt;/li&gt;&#xA;&lt;li&gt;The best practice based on the core feature, which I kind of think is still to be explored.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;SPAs, or Single Page Applications, can often be deployed as static files. While a separate server may exist, it typically doesn’t serve the SPA itself. In this context, an SPA can have multiple pages, but let&amp;rsquo;s not argue about the precise definition.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How I Got Involved in OSS</title>
      <link>https://blog.axlight.com/posts/how-i-got-involved-in-oss/</link>
      <pubDate>Tue, 03 Sep 2024 22:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-i-got-involved-in-oss/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;In this post, I would like to reflect on my journey in open source software development.&lt;/p&gt;&#xA;&lt;h3 id=&#34;my-first-oss-contribution&#34;&gt;My first OSS contribution&lt;/h3&gt;&#xA;&lt;p&gt;Around the year 2000, I made my first contribution to OSS: an Ethernet driver for NetBSD/mac68k. It was written in C, and now, looking back, I can barely understand the code.&lt;/p&gt;&#xA;&lt;p&gt;Found this link on the Web:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/mac68k/nubus/if_netdock_nubus.c?rev=1.35&amp;amp;content-type=text/x-cvsweb-markup&#34;&gt;http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/mac68k/nubus/if_netdock_nubus.c?rev=1.35&amp;amp;content-type=text/x-cvsweb-markup&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;chicken-scheme&#34;&gt;Chicken Scheme&lt;/h3&gt;&#xA;&lt;p&gt;Another phase in my OSS journey was working with Scheme. Although my contributions were small, I did contribute to a few libraries.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How Valtio Was Born</title>
      <link>https://blog.axlight.com/posts/how-valtio-was-born/</link>
      <pubDate>Sun, 18 Aug 2024 21:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-valtio-was-born/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;There was a discussion in our team after releasing Zustand v3 and the brand new Jotai. It was about whether we could develop another library for global state.&lt;/p&gt;&#xA;&lt;p&gt;In this post, I will reflect on the start of Valtio&amp;rsquo;s development and its API design.&lt;/p&gt;&#xA;&lt;h3 id=&#34;hesitation-at-first&#34;&gt;Hesitation at First&lt;/h3&gt;&#xA;&lt;p&gt;While the idea of a proxy state sounded promising, I was hesitant to develop a third global state library at first. We were already maintaining two libraries in the same problem domain. It felt like adding another library would make no sense.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How Jotai Was Born</title>
      <link>https://blog.axlight.com/posts/how-jotai-was-born/</link>
      <pubDate>Fri, 09 Aug 2024 22:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-jotai-was-born/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;In this post, I would like to share the story of why I started developing Jotai. While Jotai is often seen as a similar solution to Recoil, there is a longer history behind its development.&lt;/p&gt;&#xA;&lt;h3 id=&#34;react-hooks&#34;&gt;React Hooks&lt;/h3&gt;&#xA;&lt;p&gt;It was October 2018 when React Hooks were first announced. I liked the idea of developing logic outside of React components, and believed that many libraries would soon adopt this approach. I wanted to develop something, and global state management was one field I picked. My motivation was to avoid Redux selectors, also known as &lt;code&gt;mapStateToProps&lt;/code&gt; at that time. In my work experience, I found that it&amp;rsquo;s pretty hard for beginners to understand referential equality. To avoid extra re-renders, we may need to use memoization libraries such as &lt;code&gt;reselect&lt;/code&gt;. It felt unnecessary if the computation of selectors themselves was fairly lightweight.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How Zustand Was Born</title>
      <link>https://blog.axlight.com/posts/how-zustand-was-born/</link>
      <pubDate>Sun, 14 Jul 2024 13:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-zustand-was-born/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;In this post, I would like to share the story behind Zustand&amp;rsquo;s development. To be precise, I wasn&amp;rsquo;t the original author of Zustand, and when Zustand v0 was born, I was developing other global state libraries, especially React-Tracked. By the way, I now consider myself a (secondary) author of Zustand.&lt;/p&gt;&#xA;&lt;p&gt;I found my tweet mentioning Zustand, comparing it with other libraries, including mine.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;twitter-tweet&#34;&gt;&lt;p lang=&#34;en&#34; dir=&#34;ltr&#34;&gt;Comparison of React hooks libraries for global state. Only about performance/optimization. Not about API design. Please let me know if there are other libraries. &lt;a href=&#34;https://t.co/UfoKOh8APL&#34;&gt;https://t.co/UfoKOh8APL&lt;/a&gt; &lt;a href=&#34;https://twitter.com/hashtag/reactjs?src=hash&amp;amp;ref_src=twsrc%5Etfw&#34;&gt;#reactjs&lt;/a&gt; &lt;a href=&#34;https://twitter.com/hashtag/javascript?src=hash&amp;amp;ref_src=twsrc%5Etfw&#34;&gt;#javascript&lt;/a&gt; &lt;a href=&#34;https://twitter.com/hashtag/reacthooks?src=hash&amp;amp;ref_src=twsrc%5Etfw&#34;&gt;#reacthooks&lt;/a&gt; &lt;a href=&#34;https://twitter.com/hashtag/redux?src=hash&amp;amp;ref_src=twsrc%5Etfw&#34;&gt;#redux&lt;/a&gt; &lt;a href=&#34;https://t.co/bPIKzdmP3u&#34;&gt;pic.twitter.com/bPIKzdmP3u&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Jotai Tips</title>
      <link>https://blog.axlight.com/posts/jotai-tips/</link>
      <pubDate>Wed, 03 Apr 2024 23:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/jotai-tips/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve been sharing tips about Jotai on Twitter,&#xA;calling them &amp;ldquo;Jotai tips.&amp;rdquo;&#xA;As tweets tend to get lost over time,&#xA;I thought it would be good to have all these tips in one place.&lt;/p&gt;&#xA;&lt;p&gt;So, here we go.&lt;/p&gt;&#xA;&lt;h2 id=&#34;tip-1-primitive-like-atoms&#34;&gt;Tip 1: Primitive-like atoms&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;twitter-tweet&#34;&gt;&lt;p lang=&#34;en&#34; dir=&#34;ltr&#34;&gt;Jotai tips: Primitive-like atoms&lt;br&gt;&lt;br&gt;You can derive a primitive atom that behaves exactly the same, and you can add some side effects. &lt;a href=&#34;https://t.co/7r6tmRGNJ0&#34;&gt;pic.twitter.com/7r6tmRGNJ0&lt;/a&gt;&lt;/p&gt;&amp;mdash; Daishi Kato (@dai_shi) &lt;a href=&#34;https://twitter.com/dai_shi/status/1694494217379459573?ref_src=twsrc%5Etfw&#34;&gt;August 23, 2023&lt;/a&gt;&lt;/blockquote&gt;&#xA;&lt;script async src=&#34;https://platform.twitter.com/widgets.js&#34; charset=&#34;utf-8&#34;&gt;&lt;/script&gt;&#xA;&#xA;&#xA;&lt;h2 id=&#34;tip-2-early-return&#34;&gt;Tip 2: Early return&lt;/h2&gt;&#xA;&lt;blockquote class=&#34;twitter-tweet&#34;&gt;&lt;p lang=&#34;en&#34; dir=&#34;ltr&#34;&gt;Jotai tips: early return&lt;br&gt;&lt;br&gt;Unlike React hooks, Jotai atoms have no limitations regarding early return. &lt;a href=&#34;https://t.co/0LaDFNeGc3&#34;&gt;pic.twitter.com/0LaDFNeGc3&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Why useSyncExternalStore Is Not Used in Jotai</title>
      <link>https://blog.axlight.com/posts/why-use-sync-external-store-is-not-used-in-jotai/</link>
      <pubDate>Sat, 28 Oct 2023 11:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/why-use-sync-external-store-is-not-used-in-jotai/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/pmndrs/jotai&#34;&gt;Jotai&lt;/a&gt; is developed to solve an extra re-render issue with React Context. A major challenge in its development has been the support of both Suspense and Concurrent rendering. Otherwise, it would have been a simpler implementation and its implementation would closely resemble that of any observable-like libraries.&lt;/p&gt;&#xA;&lt;p&gt;As of writing, Jotai is fully compatible with Suspense and Concurrent rendering with some exceptions. There&amp;rsquo;s a repo to evaluate some details.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to Use Jotai and useTransition for Mutation</title>
      <link>https://blog.axlight.com/posts/how-to-use-jotai-and-use-transition-for-mutation/</link>
      <pubDate>Fri, 28 Jul 2023 01:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-to-use-jotai-and-use-transition-for-mutation/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/pmndrs/jotai&#34;&gt;Jotai&lt;/a&gt;&#xA;is a powerful library designed for seamless integration with React Suspense.&#xA;Unlike Zustand, Jotai&amp;rsquo;s primary focus is React Suspense from the beginning.&lt;/p&gt;&#xA;&lt;p&gt;In its simplest form, Jotai effortlessly works with Suspense,&#xA;and gives superior developer experience and user experience with async data.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://codesandbox.io/s/vjfpcd&#34;&gt;https://codesandbox.io/s/vjfpcd&lt;/a&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-tsx&#34; data-lang=&#34;tsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;import&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;Suspense&lt;/span&gt; } &lt;span style=&#34;color:#66d9ef&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;react&amp;#34;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;import&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;atom&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;useAtomValue&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;useSetAtom&lt;/span&gt; } &lt;span style=&#34;color:#66d9ef&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;jotai&amp;#34;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;postAtom&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;atom&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;async&lt;/span&gt; (&lt;span style=&#34;color:#66d9ef&#34;&gt;get&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;await&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;fetch&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;`https://jsonplaceholder.typicode.com/posts/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;`&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;data&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;await&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;res&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;json&lt;/span&gt;();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;data&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;});&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Post&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; () &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;title&lt;/span&gt; } &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;useAtomValue&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;postAtom&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;Title&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; {&lt;span style=&#34;color:#a6e22e&#34;&gt;title&lt;/span&gt;}&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;};&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;App&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; () &lt;span style=&#34;color:#f92672&#34;&gt;=&amp;gt;&lt;/span&gt; (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;Suspense&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;fallback&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Loading...&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;Post&lt;/span&gt; /&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;Suspense&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;export&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;default&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;App&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;There are no issues so far.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Why Zustand Typescript Implementation Is So Ugly</title>
      <link>https://blog.axlight.com/posts/why-zustand-typescript-implementation-is-so-ugly/</link>
      <pubDate>Wed, 19 Jul 2023 15:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/why-zustand-typescript-implementation-is-so-ugly/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;Note: This post focuses on Zustand library&amp;rsquo;s implementation in TypeScript.&#xA;It does not affect the user code, which should be kept clean.&lt;/p&gt;&#xA;&lt;p&gt;Zustand&amp;rsquo;s JavaScript implementation is very small, as seen in the following tweet.&lt;/p&gt;&#xA;&lt;blockquote class=&#34;twitter-tweet&#34;&gt;&lt;p lang=&#34;en&#34; dir=&#34;ltr&#34;&gt;Here&amp;#39;s the Zustand code in JS in a tweet.&lt;br&gt;I think I did this before, but this is slightly a new version.&lt;br&gt;Not in 140 chars, but in an image. 😅&lt;br&gt;&lt;br&gt;Source: &lt;a href=&#34;https://t.co/SEBiC7bObe&#34;&gt;https://t.co/SEBiC7bObe&lt;/a&gt; &lt;a href=&#34;https://t.co/kLcHnMN5je&#34;&gt;pic.twitter.com/kLcHnMN5je&lt;/a&gt;&lt;/p&gt;&amp;mdash; Daishi Kato (@dai_shi) &lt;a href=&#34;https://twitter.com/dai_shi/status/1583082766081531905?ref_src=twsrc%5Etfw&#34;&gt;October 20, 2022&lt;/a&gt;&lt;/blockquote&gt;&#xA;&lt;script async src=&#34;https://platform.twitter.com/widgets.js&#34; charset=&#34;utf-8&#34;&gt;&lt;/script&gt;&#xA;&#xA;&#xA;&lt;p&gt;However, its TypeScript implementation is quite complicated.&#xA;There are several reasons, one of which we explore in this post.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Why You Don&#39;t Need Signals in React</title>
      <link>https://blog.axlight.com/posts/why-you-dont-need-signals-in-react/</link>
      <pubDate>Sun, 23 Apr 2023 21:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/why-you-dont-need-signals-in-react/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;In the world of web frontend development, signals have become a popular topic.&#xA;At their core, signals are used to represent changes in state over time.&#xA;Some developers have discussed the potential of using signals&#xA;in conjunction with React.&lt;/p&gt;&#xA;&lt;p&gt;Signals are actually an older concept, and it&amp;rsquo;s uncertain&#xA;how they are understood by modern web developers.&#xA;Initially, I was confused about the characteristics of signals,&#xA;but I later realized that they can be boiled down to two main aspects:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Demystifying Create React Signals Internals</title>
      <link>https://blog.axlight.com/posts/demystifying-create-react-signals-internals/</link>
      <pubDate>Sun, 26 Feb 2023 23:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/demystifying-create-react-signals-internals/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;When I first saw SolidJS and Preact Signals,&#xA;I thought they are interesting but they are different from React.&#xA;What made me motivated is &lt;a href=&#34;https://www.npmjs.com/package/@preact/signals-react&#34;&gt;@preact/signals-react&lt;/a&gt;.&#xA;I didn&amp;rsquo;t like the original implementation using REACT INTERNALS,&#xA;and that drove me to create something.&lt;/p&gt;&#xA;&lt;p&gt;We already had Jotai. Jotai atoms are like signals,&#xA;representing reactive sources,&#xA;and allowing to form a dependency graph or a data flow.&#xA;The missing piece was signal-like syntax without hooks.&lt;/p&gt;</description>
    </item>
    <item>
      <title>You Might Not Need React Query for Jotai</title>
      <link>https://blog.axlight.com/posts/you-might-not-need-react-query-for-jotai/</link>
      <pubDate>Tue, 31 Jan 2023 14:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/you-might-not-need-react-query-for-jotai/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;When Jotai development was started (before releasing v1),&#xA;it has a simple goal. It optimizes re-renders, which was&#xA;often a problem with useState and useContext using a big state object.&#xA;We also wanted to avoid using selector function,&#xA;which is popularized by Redux and widely used.&lt;/p&gt;&#xA;&lt;p&gt;In the early days, I wanted to have data fetching solution,&#xA;but didn&amp;rsquo;t want to complicate Jotai itself.&#xA;So, &lt;code&gt;jotai/query&lt;/code&gt; package was created.&#xA;It&amp;rsquo;s an integration with React Query v3.&#xA;It went well, but I noticed a certain mismatch with users.&#xA;While my mental model was to create a data fetching API &lt;em&gt;for&lt;/em&gt; Jotai,&#xA;people want full features from React Query.&#xA;I had been struggling with the mismatch, and&#xA;ended up with creating a new library &lt;code&gt;jotai-tanstack-query&lt;/code&gt;.&#xA;It integrates TanStack Query v4 and covers full features.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Why We Need Jotai v2 API</title>
      <link>https://blog.axlight.com/posts/why-we-need-jotai-v2-api/</link>
      <pubDate>Tue, 06 Dec 2022 14:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/why-we-need-jotai-v2-api/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/pmndrs/jotai&#34;&gt;Jotai&lt;/a&gt;&#xA;is a library for React state management.&lt;/p&gt;&#xA;&lt;p&gt;The API (let&amp;rsquo;s call it v1 API) is designed to&#xA;a) be friendly with Concurrent React, and&#xA;b) be compatible with Recoil as much as possible.&lt;/p&gt;&#xA;&lt;p&gt;What does it mean?&#xA;First, atom read function is evaluated in the render phase in React.&lt;/p&gt;&#xA;&lt;p&gt;For example, consider a simple derived atom.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;countAtom&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;atom&lt;/span&gt;(&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;doubleAtom&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;atom&lt;/span&gt;((&lt;span style=&#34;color:#a6e22e&#34;&gt;get&lt;/span&gt;) =&amp;gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;get&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;countAtom&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the example, &lt;code&gt;(get) =&amp;gt; get(countAtom) * 2&lt;/code&gt; is the read function.&#xA;When &lt;code&gt;countAtom&lt;/code&gt; is updated, the library doesn&amp;rsquo;t&#xA;invoke the read function of &lt;code&gt;doubleAtom&lt;/code&gt; immediately.&#xA;Instead, it triggers the component that uses &lt;code&gt;doubleAtom&lt;/code&gt; to re-render.&#xA;The component re-renders eventually, and&#xA;it&amp;rsquo;s when the read function of &lt;code&gt;doubleAtom&lt;/code&gt; is invoked.&#xA;The benefit of this behavior might be hypothetical,&#xA;but React allows to schedule re-renders, which means&#xA;it can skip invoking read functions in concurrent rendering.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How Jotai Specifies Package Entry Points</title>
      <link>https://blog.axlight.com/posts/how-jotai-specifies-package-entry-points/</link>
      <pubDate>Sun, 17 Apr 2022 17:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-jotai-specifies-package-entry-points/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;If someone has already looked into &lt;code&gt;package.json&lt;/code&gt; in the jotai library,&#xA;they may find &lt;code&gt;&amp;quot;exports&amp;quot;&lt;/code&gt; field.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/pmndrs/jotai/blob/v1.6.4/package.json#L18-L31&#34;&gt;https://github.com/pmndrs/jotai/blob/v1.6.4/package.json#L18-L31&lt;/a&gt;&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-json&#34; data-lang=&#34;json&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;exports&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#960050;background-color:#1e0010&#34;&gt;:&lt;/span&gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;./package.json&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;./package.json&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;.&amp;#34;&lt;/span&gt;: {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;types&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;./index.d.ts&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;module&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;./esm/index.js&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;import&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;./esm/index.mjs&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;default&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;./index.js&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    },&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;./utils&amp;#34;&lt;/span&gt;: {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;types&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;./utils.d.ts&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;module&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;./esm/utils.js&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;import&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;./esm/utils.mjs&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &lt;span style=&#34;color:#f92672&#34;&gt;&amp;#34;default&amp;#34;&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;./utils.js&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    },&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the Node.js docs, it is described as&#xA;&lt;a href=&#34;https://nodejs.org/api/packages.html#package-entry-points&#34;&gt;Package entry points&lt;/a&gt;.&#xA;Node.js v12.7.0 &lt;a href=&#34;https://nodejs.org/en/blog/release/v12.7.0/&#34;&gt;started implementing it.&lt;/a&gt;&#xA;Nowadays, it&amp;rsquo;s used also by bundlers like webpack and vite.&lt;/p&gt;&#xA;&lt;p&gt;We use package entry points for separating modules.&#xA;For example, &lt;code&gt;jotai&lt;/code&gt; is a core module exporting core functions.&#xA;&lt;code&gt;jotai/utils&lt;/code&gt; is a separate module which exports additional functions&#xA;based on core functions.&#xA;(By the way, another option is to publish two packages instead.&#xA;But, we prefer multiple entry points in a single package.)&lt;/p&gt;</description>
    </item>
    <item>
      <title>When I Use Valtio and When I Use Jotai</title>
      <link>https://blog.axlight.com/posts/when-i-use-valtio-and-when-i-use-jotai/</link>
      <pubDate>Sun, 30 Jan 2022 18:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/when-i-use-valtio-and-when-i-use-jotai/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;Recently, I often got asked about this question:&#xA;Which is recommended, valtio or jotai?&lt;/p&gt;&#xA;&lt;p&gt;For those who are not familiar with them,&#xA;they are two out of many state management libraries that I developed.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/pmndrs/valtio&#34;&gt;https://github.com/pmndrs/valtio&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/pmndrs/jotai&#34;&gt;https://github.com/pmndrs/jotai&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, from the library perspective, their implementations are very different.&#xA;However, from the usage perspective, I understand the confusion.&#xA;Both serve similar functionalities and we don&amp;rsquo;t usually use both&#xA;in a single app.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How Valtio Proxy State Works (React Part)</title>
      <link>https://blog.axlight.com/posts/how-valtio-proxy-state-works-react-part/</link>
      <pubDate>Sun, 26 Dec 2021 22:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-valtio-proxy-state-works-react-part/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;In &lt;a href=&#34;https://blog.axlight.com/posts/how-valtio-proxy-state-works-vanilla-part/&#34;&gt;the previous article&lt;/a&gt;,&#xA;we explained how &lt;a href=&#34;http://github.com/pmndrs/valtio&#34;&gt;Valtio&lt;/a&gt;&#xA;proxy state works.&#xA;It tracks mutations of state and create immutable snapshot.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s recap the API in vanilla part of Valtio.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Create a new proxy state to detect mutations&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;state&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;proxy&lt;/span&gt;({ &lt;span style=&#34;color:#a6e22e&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt; });&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// You can mutate it&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;state&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;count&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Create a snapshot&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;snap1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;snapshot&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;state&lt;/span&gt;); &lt;span style=&#34;color:#75715e&#34;&gt;// ---&amp;gt; { count: 1 }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Mutate it again&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;state&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;count&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;10&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Create a snapshot again&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;snap2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;snapshot&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;state&lt;/span&gt;); &lt;span style=&#34;color:#75715e&#34;&gt;// ---&amp;gt; { count: 10 }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// The previous snapshot is not changed&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;console&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;log&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;snap1&lt;/span&gt;); &lt;span style=&#34;color:#75715e&#34;&gt;// ---&amp;gt; { count: 1 }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// You can subscribe to it&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;subscribe&lt;/span&gt;(&lt;span style=&#34;color:#a6e22e&#34;&gt;state&lt;/span&gt;, () =&amp;gt; {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;console&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;log&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;State changed to&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;state&lt;/span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;});&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// Then, mutate it again&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;state&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;text&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;hello&amp;#39;&lt;/span&gt;; &lt;span style=&#34;color:#75715e&#34;&gt;// ---&amp;gt; &amp;#34;State changed to { count: 10, text: &amp;#39;hello&amp;#39; }&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, let&amp;rsquo;s see how we can use the state in React.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Learning React State Manager Jotai With 7GUIS Tasks</title>
      <link>https://blog.axlight.com/posts/learning-react-state-manager-jotai-with-7guis-tasks/</link>
      <pubDate>Mon, 13 Sep 2021 20:23:30 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/learning-react-state-manager-jotai-with-7guis-tasks/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;I stumbled upon &lt;a href=&#34;https://eugenkiss.github.io/7guis/&#34;&gt;7GUIS&lt;/a&gt; tasks while reading&#xA;&lt;a href=&#34;https://xstate.js.org/docs/tutorials/7guis/counter.html&#34;&gt;XState Tutorials&lt;/a&gt;.&#xA;This motivated me to challenge those 7 tasks with&#xA;&lt;a href=&#34;https://github.com/pmndrs/jotai&#34;&gt;jotai&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;It turned out that this would be a good resource to learn jotai.&#xA;They are from basic tasks to advanced tasked, and you will&#xA;see how they are implemented, occasionally magically.&lt;/p&gt;&#xA;&lt;p&gt;It&amp;rsquo;s recommended to try it yourself first.&#xA;If you succeed to implement it, then you can compare.&#xA;Even if you fail, you can read and learn.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How Valtio Proxy State Works (Vanilla Part)</title>
      <link>https://blog.axlight.com/posts/how-valtio-proxy-state-works-vanilla-part/</link>
      <pubDate>Fri, 27 Aug 2021 22:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-valtio-proxy-state-works-vanilla-part/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://github.com/pmndrs/valtio&#34;&gt;Valtio&lt;/a&gt; is a library for&#xA;global state primarily for React.&#xA;It&amp;rsquo;s originally modeled to match with&#xA;&lt;a href=&#34;https://github.com/reactjs/rfcs/blob/master/text/0147-use-mutable-source.md&#34;&gt;useMutableSource&lt;/a&gt;&#xA;API.&#xA;However, it turns out it&amp;rsquo;s a novel API to add&#xA;immutability to mutable state.&lt;/p&gt;&#xA;&lt;p&gt;What is immutable state? JavaScript doesn&amp;rsquo;t support&#xA;immutability as language, so it&amp;rsquo;s just a coding contract.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;immutableState1&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;text&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;hello&amp;#39;&lt;/span&gt; };&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// update the state&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;immutableState2&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; { ...&lt;span style=&#34;color:#a6e22e&#34;&gt;immutableState1&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;immutableState1&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;count&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; };&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;// update it again&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;immutableState3&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; { ...&lt;span style=&#34;color:#a6e22e&#34;&gt;immutableState2&lt;/span&gt;, &lt;span style=&#34;color:#a6e22e&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;immutableState2&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;count&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt; };&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Some people might be familiar with this pattern,&#xA;or it can be new to some other people.&#xA;We always create a new object without modifying the existing ones.&#xA;This allows us to compare the state objects.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Testing Global State Libraries With React 18 Alpha Concurrent Rendering</title>
      <link>https://blog.axlight.com/posts/testing-global-state-libraries-with-react-18-alpha-concurrent-rendering/</link>
      <pubDate>Thu, 10 Jun 2021 21:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/testing-global-state-libraries-with-react-18-alpha-concurrent-rendering/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;The React team announced &lt;a href=&#34;https://reactjs.org/blog/2021/06/08/the-plan-for-react-18.html&#34;&gt;The Plan for React 18&lt;/a&gt; with various features.&#xA;Among them, concurrent rendering is one of my interests&#xA;because I have been developing various global state libraries&#xA;and there are known issues called &amp;ldquo;tearing&amp;rdquo; and &amp;ldquo;branching&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;Tearing is an undesirable behavior in which&#xA;two components render with different values for same global state.&lt;/p&gt;&#xA;&lt;p&gt;Branching is a desirable behavior in which&#xA;a component renders with a stale value for a state in a transition update.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Developing a Memoization Library With Proxies</title>
      <link>https://blog.axlight.com/posts/developing-a-memoization-library-with-proxies/</link>
      <pubDate>Sun, 29 Nov 2020 14:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/developing-a-memoization-library-with-proxies/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;It&amp;rsquo;s been a while since I started developing&#xA;&lt;a href=&#34;https://github.com/dai-shi/reactive-react-redux&#34;&gt;reactive-react-redux&lt;/a&gt;&#xA;and &lt;a href=&#34;https://github.com/dai-shi/react-tracked&#34;&gt;react-tracked&lt;/a&gt;.&#xA;These libraries provide so called&#xA;&lt;a href=&#34;https://blog.axlight.com/posts/what-is-state-usage-tracking-a-novel-approach-to-intuitive-and-performant-api-with-react-hooks-and-proxy/&#34;&gt;state usage tracking&lt;/a&gt; to optimize render in React.&#xA;This approach, I think, is pretty novel and&#xA;quite a lot of my effort has been put to improve its performance.&lt;/p&gt;&#xA;&lt;p&gt;Lately, I thought it would be nicer if this can be used more broadly.&#xA;I wondered if it can be used in vanilla JS.&#xA;What would be an API in vanilla JS?&#xA;It would be good if it&amp;rsquo;s easy to understand.&#xA;My idea ended up with memoization, mainly because&#xA;the primary goal is to be a replacement of&#xA;&lt;a href=&#34;https://github.com/reduxjs/reselect&#34;&gt;reselect&lt;/a&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Developing React Global State Library With Atom Abstraction</title>
      <link>https://blog.axlight.com/posts/developing-react-global-state-library-with-atom-abstraction/</link>
      <pubDate>Thu, 13 Aug 2020 08:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/developing-react-global-state-library-with-atom-abstraction/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;I have been developing various global state libraries for React.&#xA;For example:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/dai-shi/react-tracked&#34;&gt;react-tracked&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/dai-shi/react-hooks-global-state&#34;&gt;react-hooks-global-state&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;My main motivation is to eliminate selector functions that&#xA;are only required for render optimization.&#xA;Render optimization here means it avoids extra re-renders.&#xA;An extra re-render is a re-render process that produces&#xA;the same view result as before.&lt;/p&gt;&#xA;&lt;p&gt;Since &lt;a href=&#34;https://github.com/facebookexperimental/Recoil&#34;&gt;Recoil&lt;/a&gt; is announced,&#xA;I&amp;rsquo;m very interested in atom abstraction because it eliminates&#xA;selector functions for render optimization and the API seems pretty intuitive.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Redux in Worker: Off-main-thread Redux Reducers and Middleware</title>
      <link>https://blog.axlight.com/posts/redux-in-worker-off-main-thread-redux-reducers-and-middleware/</link>
      <pubDate>Sun, 29 Mar 2020 20:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/redux-in-worker-off-main-thread-redux-reducers-and-middleware/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;Redux is a framework-agnostic library for global state.&#xA;It&amp;rsquo;s often used with React.&lt;/p&gt;&#xA;&lt;p&gt;While I like the abstraction of Redux,&#xA;React will introduce Concurrent Mode in the near future.&#xA;If we want to get benefit of &lt;code&gt;useTransition&lt;/code&gt;,&#xA;state must be inside React to allow state branching.&#xA;That means we can&amp;rsquo;t get the benefit with Redux.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve been developing &lt;a href=&#34;https://react-tracked.js.org&#34;&gt;React Tracked&lt;/a&gt;&#xA;for global state that allows state branching.&#xA;It works well in Concurrent Mode.&#xA;That leaves me a question: What is a use case that only Redux can do.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Steps to Develop Global State for React With Hooks Without Context</title>
      <link>https://blog.axlight.com/posts/steps-to-develop-global-state-for-react/</link>
      <pubDate>Tue, 18 Feb 2020 23:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/steps-to-develop-global-state-for-react/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;Developing with React hooks is fun for me.&#xA;I have been developing several libraries.&#xA;The very first library was a library for global state.&#xA;It&amp;rsquo;s naively called &amp;ldquo;react-hooks-global-state&amp;rdquo; which&#xA;turns out to be too long to read.&lt;/p&gt;&#xA;&lt;p&gt;The initial version of the library was published in Oct 2018.&#xA;Time has passed since then, I learned a lot, and now&#xA;v1.0.0 of the library is published.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/dai-shi/react-hooks-global-state&#34;&gt;https://github.com/dai-shi/react-hooks-global-state&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This post shows simplified versions of the code step by step.&#xA;It would help understand what this library is aiming at,&#xA;while the real code is a bit complex in TypeScript.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Lazy Load Apollo Link in Apollo Client</title>
      <link>https://blog.axlight.com/posts/lazy-load-apollo-link-in-apollo-client/</link>
      <pubDate>Fri, 10 Jan 2020 23:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/lazy-load-apollo-link-in-apollo-client/</guid>
      <description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;This is a short post about my small library.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/apollographql/apollo-client&#34;&gt;Apollo Client&lt;/a&gt;&#xA;is a library for GraphQL.&#xA;&lt;a href=&#34;https://github.com/apollographql/apollo-link&#34;&gt;Apollo Link&lt;/a&gt;&#xA;is an interface to extend Apollo Client.&lt;/p&gt;&#xA;&lt;p&gt;Typically, you would initialize apollo client like this.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;import&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;ApolloClient&lt;/span&gt; } &lt;span style=&#34;color:#a6e22e&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;apollo-client&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;import&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;InMemoryCache&lt;/span&gt; } &lt;span style=&#34;color:#a6e22e&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;apollo-cache-inmemory&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;import&lt;/span&gt; { &lt;span style=&#34;color:#a6e22e&#34;&gt;HttpLink&lt;/span&gt; } &lt;span style=&#34;color:#a6e22e&#34;&gt;from&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;apollo-link-http&amp;#39;&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;cache&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;InMemoryCache&lt;/span&gt;();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;link&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;HttpLink&lt;/span&gt;({ &lt;span style=&#34;color:#a6e22e&#34;&gt;uri&lt;/span&gt; });&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;client&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;new&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;ApolloClient&lt;/span&gt;({&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;cache&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;cache&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#a6e22e&#34;&gt;link&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;link&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;});&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I want to define the link in another file and lazy load it,&#xA;because it is not an HttpLink but a complicated large link.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to Handle Async Actions for Global State With React Hooks and Context</title>
      <link>https://blog.axlight.com/posts/how-to-handle-async-actions-for-global-state-with-react-hooks-and-context/</link>
      <pubDate>Fri, 20 Dec 2019 23:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-to-handle-async-actions-for-global-state-with-react-hooks-and-context/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;I have been developing React Tracked, which is&#xA;a library for global state with React Hooks and Context.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://react-tracked.js.org&#34;&gt;https://react-tracked.js.org&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This is a small library and focuses on only one thing.&#xA;It optimizes re-renders using state usage tracking.&#xA;More technically, it uses Proxies to detect the usage in render,&#xA;and only triggers re-renders if necessary.&lt;/p&gt;&#xA;&lt;p&gt;Because of that, the usage of React Tracked is very straightforward.&#xA;It is just like the normal useContext. Here&amp;rsquo;s an example.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Diving Into React Suspense Render-as-You-Fetch for REST APIs</title>
      <link>https://blog.axlight.com/posts/diving-into-react-suspense-render-as-you-fetch-for-rest-apis/</link>
      <pubDate>Mon, 16 Dec 2019 22:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/diving-into-react-suspense-render-as-you-fetch-for-rest-apis/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;React released Concurrent Mode in the experimental channel&#xA;and &lt;a href=&#34;https://reactjs.org/docs/concurrent-mode-suspense.html&#34;&gt;Suspense for Data Fetching&lt;/a&gt;.&#xA;This release is for library authors, and not for production apps yet.&#xA;The new data fetching pattern proposed is called Render-as-You-Fetch.&lt;/p&gt;&#xA;&lt;p&gt;This post mainly discuss Render-as-You-Fetch for basic fetch calls,&#xA;like calling REST APIs. But, some of discussions are not limited to REST.&#xA;One could invoke GraphQL endpoints with simple fetch calls.&#xA;For more complex use cases with GraphQL, it&amp;rsquo;s worth looking into&#xA;&lt;a href=&#34;https://relay.dev/docs/en/experimental/a-guided-tour-of-relay#advanced-data-fetching&#34;&gt;Relay documentation&lt;/a&gt; too.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Developing a React Library for Suspense for Data Fetching in Concurrent Mode</title>
      <link>https://blog.axlight.com/posts/developing-a-react-library-for-suspense-for-data-fetching-in-concurrent-mode/</link>
      <pubDate>Sun, 03 Nov 2019 21:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/developing-a-react-library-for-suspense-for-data-fetching-in-concurrent-mode/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;We have been waiting for &amp;ldquo;Suspense for Data Fetching&amp;rdquo; for a long time.&#xA;It is now provided as an experimental feature in&#xA;&lt;a href=&#34;https://reactjs.org/blog/2019/10/22/react-release-channels.html&#34;&gt;the experimental channel&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Check out the official docs for details.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://reactjs.org/docs/concurrent-mode-intro.html&#34;&gt;Introducing Concurrent Mode&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://reactjs.org/docs/concurrent-mode-suspense.html&#34;&gt;Suspense for Data Fetching&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://reactjs.org/docs/concurrent-mode-patterns.html&#34;&gt;Concurrent UI Patterns&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://reactjs.org/docs/concurrent-mode-adoption.html&#34;&gt;Adopting Concurrent Mode&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://reactjs.org/docs/concurrent-mode-reference.html&#34;&gt;Concurrent Mode API Reference&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;They are trying best to explain new mind sets with analogies.&#xA;That means it&amp;rsquo;s totally different from the usage with traditional React.&#xA;Yes, it is different and promising.&lt;/p&gt;</description>
    </item>
    <item>
      <title>React Tracked Documentation Website with Docusaurus v2</title>
      <link>https://blog.axlight.com/posts/react-tracked-documentation-website-with-docusaurus-v2/</link>
      <pubDate>Tue, 15 Oct 2019 23:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/react-tracked-documentation-website-with-docusaurus-v2/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;I have been developing a React Hooks library called React Tracked.&#xA;This is the library I put much effort lately as well as&#xA;my other libraries.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/dai-shi/react-tracked&#34;&gt;https://github.com/dai-shi/react-tracked&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This library solves a performance issue with React Context.&#xA;For those who are interested in the fundamental problem,&#xA;please take a look at &lt;a href=&#34;https://github.com/facebook/react/issues/14110&#34;&gt;the long issue&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;What&amp;rsquo;s notable in this library is that&#xA;it doesn&amp;rsquo;t provide any new fancy features.&#xA;You can simply replace Context.Provider and useContext&#xA;with the custom ones, it just works with performance.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Off-main-thread React Redux with Performance</title>
      <link>https://blog.axlight.com/posts/off-main-thread-react-redux-with-performance/</link>
      <pubDate>Mon, 16 Sep 2019 11:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/off-main-thread-react-redux-with-performance/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;It is said that Redux has been overused in some use cases&#xA;and React context+hooks plays well in such use cases.&#xA;While I agree with it, Redux should work well in some other situations.&#xA;Redux should help developing larger apps with many developers.&#xA;Various libraries in Redux ecosystem should accelerate development.&#xA;There&amp;rsquo;s another situation in which Redux may help, and that is Web Workers.&lt;/p&gt;&#xA;&lt;p&gt;A while back, Surma posted a nice blog post:&#xA;&lt;a href=&#34;https://dassur.ma/things/react-redux-comlink/&#34;&gt;React + Redux + Comlink = Off-main-thread&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>How I Developed React Hooks for Web Workers</title>
      <link>https://blog.axlight.com/posts/how-i-developed-react-hooks-for-web-workers/</link>
      <pubDate>Sun, 08 Sep 2019 16:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-i-developed-react-hooks-for-web-workers/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;I have been developing several react hooks libraries.&#xA;They provide custom hooks for certain purposes.&#xA;One of them is for web workers.&#xA;I started it for fun. I got some feedbacks and improved.&#xA;This post shows the current implementation which aims the use in production.&lt;/p&gt;&#xA;&lt;p&gt;In this field, &lt;a href=&#34;https://github.com/GoogleChromeLabs/comlink&#34;&gt;Comlink&lt;/a&gt;&#xA;provides a nice transparent API with Proxies.&#xA;Some might have already tried it with React.&#xA;I have two reasons why I don&amp;rsquo;t use it for my library.&lt;/p&gt;</description>
    </item>
    <item>
      <title>4 options to prevent extra rerenders with React context</title>
      <link>https://blog.axlight.com/posts/4-options-to-prevent-extra-rerenders-with-react-context/</link>
      <pubDate>Wed, 21 Aug 2019 21:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/4-options-to-prevent-extra-rerenders-with-react-context/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;React context and useContext are very handy.&#xA;You would have no problem using it while developing a small app.&#xA;If the size of your app became non-trivial,&#xA;you might experience some performance issues with regard to useContext.&#xA;This is because useContext will trigger rerender&#xA;whenever the context value is changed.&#xA;This happens even if the part of the value is not used in render.&#xA;This is by design. If useContext were to conditionally&#xA;trigger rerenders, the hook would become non-composable.&lt;/p&gt;</description>
    </item>
    <item>
      <title>React hooks-oriented Redux coding pattern without thunks and action creators</title>
      <link>https://blog.axlight.com/posts/react-hooks-oriented-redux-coding-pattern-without-thunks-and-action-creators/</link>
      <pubDate>Mon, 12 Aug 2019 10:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/react-hooks-oriented-redux-coding-pattern-without-thunks-and-action-creators/</guid>
      <description>&lt;h3 id=&#34;motivation&#34;&gt;Motivation&lt;/h3&gt;&#xA;&lt;p&gt;I love Redux. But that doesn&amp;rsquo;t mean I like all parts of Redux ecosystem.&#xA;Some people dislike Redux because of its boilerplate code. That&amp;rsquo;s sad.&#xA;Boilerplate code is not from the Redux core, but from the ecosystem.&#xA;Don&amp;rsquo;t get me wrong. Best practices are nice and I think&#xA;the recent work of Redux Starter Kit is great. (Claps to Mark)&lt;/p&gt;&#xA;&lt;p&gt;I think I have my own understanding of how to use Redux with React.&#xA;It may not be common and probably it will never be the mainstream.&#xA;I understand Redux is useful and tuned for larger applications.&#xA;What I have in mind is the usage for smaller apps and for beginners.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How I developed a Concurrent Mode friendly library for React Redux</title>
      <link>https://blog.axlight.com/posts/how-i-developed-a-concurrent-mode-friendly-library-for-react-redux/</link>
      <pubDate>Sat, 27 Jul 2019 23:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-i-developed-a-concurrent-mode-friendly-library-for-react-redux/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;I have been developing several React hooks libraries for months.&#xA;In this post, I will explain why and how I developed&#xA;a React Redux binding library with React hooks.&#xA;The library is implemented to be concurrent mode friendly.&#xA;Let&amp;rsquo;s discuss why it&amp;rsquo;s important and what&amp;rsquo;s the technique behind it.&lt;/p&gt;&#xA;&lt;p&gt;React concurrent mode has not come yet,&#xA;and all discussions are based on the current unstable behavior.&#xA;Please note that when concurrent mode is released and&#xA;best practice is researched, things may change.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Effortless render optimization with state usage tracking with React hooks</title>
      <link>https://blog.axlight.com/posts/effortless-render-optimization-with-state-usage-tracking-with-react-hooks/</link>
      <pubDate>Sun, 21 Jul 2019 13:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/effortless-render-optimization-with-state-usage-tracking-with-react-hooks/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;React useContext is very handy to avoid prop drilling.&#xA;It can be used to define global state or shared state&#xA;that multiple components in the tree can access.&lt;/p&gt;&#xA;&lt;p&gt;However, useContext is not specifically designed for&#xA;global state and there&amp;rsquo;s a caveat.&#xA;Any change to context value propagates all useContext&#xA;to re-render components.&lt;/p&gt;&#xA;&lt;p&gt;This post shows some example code about the problem&#xA;and the solution with state usage tracking.&lt;/p&gt;&#xA;&lt;h3 id=&#34;problem&#34;&gt;Problem&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s assume a person object as a state.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to use react-tracked: React hooks-oriented Todo List example</title>
      <link>https://blog.axlight.com/posts/how-to-use-react-tracked-react-hooks-oriented-todo-list-example/</link>
      <pubDate>Mon, 08 Jul 2019 01:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-to-use-react-tracked-react-hooks-oriented-todo-list-example/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;React hooks have changed the way to compose components.&#xA;This post will show an example which is very hooks-oriented.&lt;/p&gt;&#xA;&lt;p&gt;We use two libraries: react-tracked and immer.&#xA;While immer makes it easy to update state in an immutable way,&#xA;react-tracked makes it easy to read state with tracking for optimization.&#xA;Please check out the repo for more details.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/dai-shi/react-tracked&#34;&gt;https://github.com/dai-shi/react-tracked&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;The example we show is the one from Redux: &lt;a href=&#34;https://redux.js.org/basics/example&#34;&gt;Todo List&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;folder-structure&#34;&gt;Folder structure&lt;/h3&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;- &lt;span style=&#34;color:#ae81ff&#34;&gt;src/&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;index.tsx&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;state.ts&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;hooks/&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;useAddTodo.ts&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;useToggleTodo.ts&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;useVisibilityFilter.ts&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;useVisibleTodos.ts&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;components/&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;AddTodo.tsx&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;App.tsx&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;FilterLink.tsx&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;Footer.tsx&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;Todo.tsx&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    - &lt;span style=&#34;color:#ae81ff&#34;&gt;VisibleTodoList.tsx&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We have two folders &lt;code&gt;components&lt;/code&gt; and &lt;code&gt;hooks&lt;/code&gt;.&#xA;Components are basically views. Hooks include logic.&lt;/p&gt;</description>
    </item>
    <item>
      <title>What is state usage tracking? A novel approach to intuitive and performant global state with React hooks and Proxy</title>
      <link>https://blog.axlight.com/posts/what-is-state-usage-tracking-a-novel-approach-to-intuitive-and-performant-api-with-react-hooks-and-proxy/</link>
      <pubDate>Sun, 07 Jul 2019 17:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/what-is-state-usage-tracking-a-novel-approach-to-intuitive-and-performant-api-with-react-hooks-and-proxy/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;There are many libraries for global state with React hooks.&#xA;React Redux also provides hooks API, which is very clean.&lt;/p&gt;&#xA;&lt;p&gt;In general, I would avoid using global state.&#xA;It would reduce the isolation of components.&#xA;Multiple contexts should work fine for certain use cases.&lt;/p&gt;&#xA;&lt;p&gt;But, what if we really need a global state.&lt;/p&gt;&#xA;&lt;h3 id=&#34;problem&#34;&gt;Problem&lt;/h3&gt;&#xA;&lt;p&gt;When a state is a non-trivial object, it&amp;rsquo;s not likely to&#xA;use all properties of the object for one component to render. &#xA;What most libraries do is to provide a selector interface.&#xA;With the selector interface,&#xA;developers can specify which part of the state to use in a component.&#xA;In general, a selector is a function,&#xA;but there are alternative ways to specify part of the state.&#xA;For example, by property names or paths.&#xA;In any case, developers are responsible to write proper selectors. &lt;/p&gt;</description>
    </item>
    <item>
      <title>Four different approaches to non-Redux global state libraries</title>
      <link>https://blog.axlight.com/posts/four-different-approaches-to-non-redux-global-state-libraries/</link>
      <pubDate>Sat, 06 Jul 2019 16:19:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/four-different-approaches-to-non-redux-global-state-libraries/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;Since React hooks landed,&#xA;there has been many libraries proposed for global state.&#xA;Some of them are simple wrappers around context.&#xA;Whereas, some of them are full featured state management systems.&lt;/p&gt;&#xA;&lt;p&gt;Technically, there are several implementations how to store&#xA;state and notify changes.&#xA;We don&amp;rsquo;t go in detail in this post, but just note two axes.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;whether context based or external store&lt;/li&gt;&#xA;&lt;li&gt;whether subscriptions based or context propagation&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;In this post, we focus on API design of hooks at the consumer end.&#xA;In my observation,&#xA;there are four approaches to the API design.&#xA;Let&amp;rsquo;s see each approach by example in pseudo code.&#xA;As a simple example, we assume an app that has the followings.&lt;/p&gt;</description>
    </item>
    <item>
      <title>React hooks useState and useReducer are equivalent in theoretical expressiveness</title>
      <link>https://blog.axlight.com/posts/react-hooks-usestate-and-usereducer-are-equivalent-in-theoretical-expressiveness/</link>
      <pubDate>Mon, 01 Jul 2019 08:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/react-hooks-usestate-and-usereducer-are-equivalent-in-theoretical-expressiveness/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;&lt;code&gt;useReducer&lt;/code&gt; is a powerful hook. It&amp;rsquo;s known that&#xA;&lt;code&gt;useState&lt;/code&gt; is implemented with &lt;code&gt;useReducer&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;In the React hooks &lt;a href=&#34;https://reactjs.org/docs/hooks-reference.html#usereducer&#34;&gt;docs&lt;/a&gt;, it&amp;rsquo;s noted like this:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;useReducer is usually preferable to useState when you have complex state logic that involves multiple sub-values or when the next state depends on the previous one. useReducer also lets you optimize performance for components that trigger deep updates because you can pass dispatch down instead of callbacks.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;For a long time, I misunderstood that useReducer is more powerful than useState&#xA;and there&amp;rsquo;s some optimization that can&amp;rsquo;t be achieved by useState.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Redux-less context-based useSelector hook that has same performance as React-Redux</title>
      <link>https://blog.axlight.com/posts/benchmark-react-tracked/</link>
      <pubDate>Sun, 16 Jun 2019 23:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/benchmark-react-tracked/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;React-Redux provides &lt;a href=&#34;https://react-redux.js.org/api/hooks&#34;&gt;hooks API&lt;/a&gt;&#xA;with nice abstraction.&#xA;Especially, &lt;code&gt;useSelector&lt;/code&gt; is probaly less misused than &lt;code&gt;mapStateToProps&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/dai-shi/react-tracked&#34;&gt;react-tracked&lt;/a&gt;&#xA;is a library for global state without Redux.&#xA;This library provides almost compatible hooks API to React-Redux.&#xA;It&amp;rsquo;s developed with performance in mind, and it should&#xA;be as performant as React-Redux, even though it utilizes&#xA;only React context. See the GitHub repo for more information.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/dai-shi/react-tracked&#34;&gt;https://github.com/dai-shi/react-tracked&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This post shows benchmark results to convince that&#xA;it actually is performant in one scenario.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Super performant global state with React context and hooks</title>
      <link>https://blog.axlight.com/posts/super-performant-global-state-with-react-context-and-hooks/</link>
      <pubDate>Sat, 15 Jun 2019 23:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/super-performant-global-state-with-react-context-and-hooks/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;There are many libraries to provide global state in React.&#xA;React itself doesn&amp;rsquo;t provide such a feature,&#xA;probably because separation of concerns is important&#xA;and having global state naively is not idiomatic.&#xA;However, in certain cases, having global state is good&#xA;as long as it&amp;rsquo;s properly implemented.&#xA;It&amp;rsquo;s likely that performance drops down&#xA;compared to using non-global state (incl. multiple contexts).&lt;/p&gt;&#xA;&lt;p&gt;This post introduces a library for global state with performance.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Redux meets hooks for non-redux users: a small concrete example with reactive-react-redux</title>
      <link>https://blog.axlight.com/posts/redux-meets-hooks-for-non-redux-users-a-small-concrete-example-with-reactive-react-redux/</link>
      <pubDate>Mon, 03 Jun 2019 23:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/redux-meets-hooks-for-non-redux-users-a-small-concrete-example-with-reactive-react-redux/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;If you had already used Redux and loved it,&#xA;you might not understand why people try&#xA;using React context and hooks to replace Redux (a.k.a no Redux hype).&#xA;For those who would think Redux DevTools Extension and middleware&#xA;are nice to have, Redux and context + hooks are actually two options.&#xA;Context + hooks is just fine to share state among components,&#xA;however if apps get bigger, they are likely to require&#xA;Redux or other similar solutions; otherwise they end up having many contexts&#xA;that can&amp;rsquo;t be handled very easily. (I&amp;rsquo;d admit this is hypothetical&#xA;and we would be able to find better solutions in the future.)&lt;/p&gt;</description>
    </item>
    <item>
      <title>Four patterns for global state with React hooks: Context or Redux</title>
      <link>https://blog.axlight.com/posts/four-patterns-for-global-state-with-react-hooks-context-or-redux/</link>
      <pubDate>Mon, 27 May 2019 00:50:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/four-patterns-for-global-state-with-react-hooks-context-or-redux/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;Global state or shared state is one of the biggest issues&#xA;when you start developing a React app.&#xA;Should we use Redux? Do hooks provide a Redux-like solution?&#xA;I would like to show four patterns toward using Redux.&#xA;This is my personal opinion and mainly for new apps.&lt;/p&gt;&#xA;&lt;h3 id=&#34;pattern-1-prop-passing&#34;&gt;Pattern 1: Prop passing&lt;/h3&gt;&#xA;&lt;p&gt;Some might think it wouldn&amp;rsquo;t scale, but the most basic pattern&#xA;should still be prop passing. If the app is small enough,&#xA;define local state in a parent component and simply pass it&#xA;down to child components. I would tolerate two level passing,&#xA;meaning one intermediate component.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Benchmark the alpha-released hooks API in React Redux with alternatives</title>
      <link>https://blog.axlight.com/posts/benchmark-alpha-released-hooks-api-in-react-redux-with-alternatives/</link>
      <pubDate>Thu, 02 May 2019 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/benchmark-alpha-released-hooks-api-in-react-redux-with-alternatives/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;Recently, React Redux released hooks API. It&amp;rsquo;s v7.1.0-alpha.4 as of writing.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/reduxjs/react-redux/releases/tag/v7.1.0-alpha.4&#34;&gt;https://github.com/reduxjs/react-redux/releases/tag/v7.1.0-alpha.4&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;On the other hand, I&amp;rsquo;ve been developing a new React Redux binding library with hooks and Proxy.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/dai-shi/reactive-react-redux&#34;&gt;https://github.com/dai-shi/reactive-react-redux&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;It&amp;rsquo;s time to benchmark both of them to have better understanding in performance. The reactive-react-redux library utilizes Proxy to auto-detect state usage, hence it technically has overhead which would affect performance. We would like to learn how much it will be affected in a realistic example.&lt;/p&gt;</description>
    </item>
    <item>
      <title>New React Redux coding style with hooks without selectors</title>
      <link>https://blog.axlight.com/posts/new-react-redux-coding-style-with-hooks-without-selectors/</link>
      <pubDate>Sat, 20 Apr 2019 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/new-react-redux-coding-style-with-hooks-without-selectors/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;React Redux is one of popular web tech stacks. As I found React hooks so promising, I have been developing a hooks-based library for React Redux called &amp;ldquo;reactive-react-redux.&amp;rdquo;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/dai-shi/reactive-react-redux&#34;&gt;https://github.com/dai-shi/reactive-react-redux&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Coding style using this library is mentally different from the official react-redux. Thanks to Proxy, developers don&amp;rsquo;t need to care about optimization, but just focus on composition of logic.&lt;/p&gt;&#xA;&lt;p&gt;This library provides two basic hooks: &lt;code&gt;useReduxState&lt;/code&gt; and &lt;code&gt;useReduxDispatch&lt;/code&gt;. This article shows example code how to use them.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Compose React hooks like composing React components</title>
      <link>https://blog.axlight.com/posts/compose-react-hooks-like-composing-react-components/</link>
      <pubDate>Thu, 18 Apr 2019 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/compose-react-hooks-like-composing-react-components/</guid>
      <description>&lt;p&gt;This short article shows code examples how hooks are analogous to components in terms of composition. Without a word, let&amp;rsquo;s jump in the code.&lt;/p&gt;&#xA;&lt;h3 id=&#34;react-components&#34;&gt;React components&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s use a minimalistic example. Here&amp;rsquo;s a component.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Person&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; ({ &lt;span style=&#34;color:#a6e22e&#34;&gt;person&lt;/span&gt; }) =&amp;gt; (&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;className&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;personFirstName&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;span&lt;/span&gt;&amp;gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;First&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;span&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;span&lt;/span&gt;&amp;gt;{&lt;span style=&#34;color:#a6e22e&#34;&gt;person&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;firstName&lt;/span&gt;}&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;span&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;className&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;personLastName&amp;#34;&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;span&lt;/span&gt;&amp;gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;Last&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Name&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;&amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;span&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;&lt;span style=&#34;color:#f92672&#34;&gt;span&lt;/span&gt;&amp;gt;{&lt;span style=&#34;color:#a6e22e&#34;&gt;person&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;lastName&lt;/span&gt;}&amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;span&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &amp;lt;/&lt;span style=&#34;color:#f92672&#34;&gt;div&lt;/span&gt;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Well, this component is a little bit big, so let&amp;rsquo;s split it into functions and compose them.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to create React custom hooks for data fetching with useEffect</title>
      <link>https://blog.axlight.com/posts/how-to-create-react-custom-hooks-for-data-fetching-with-useeffect/</link>
      <pubDate>Wed, 03 Apr 2019 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-to-create-react-custom-hooks-for-data-fetching-with-useeffect/</guid>
      <description>&lt;h3 id=&#34;background&#34;&gt;Background&lt;/h3&gt;&#xA;&lt;p&gt;React 16.8 added a new API, Hooks. If you haven&amp;rsquo;t learned hooks yet, go to the official site and read the entire document before continuing this article.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://reactjs.org/docs/hooks-intro.html&#34;&gt;https://reactjs.org/docs/hooks-intro.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Hooks are a new addition in React 16.8. They let you use state and other React features without writing a class. This…&#xA;reactjs.org&#xA;This article is about how to create custom hooks for data fetching. As described in &lt;a href=&#34;https://reactjs.org/blog/2018/11/27/react-16-roadmap.html&#34;&gt;the roadmap&lt;/a&gt;, React is planning to release react-cache and Suspense for data fetching in the near future. This is going to be a standard way of data fetching in React, however, data fetching with useEffect is still useful in certain use cases where the lifecycle of fetched data is the same as that of components. In such use cases, caching is not important and we can safely store fetched data in a component local state.&lt;/p&gt;</description>
    </item>
    <item>
      <title>How to properly use the React useRef hook in Concurrent Mode</title>
      <link>https://blog.axlight.com/posts/how-to-properly-use-the-react-useref-hook-in-concurrent-mode/</link>
      <pubDate>Thu, 07 Mar 2019 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/how-to-properly-use-the-react-useref-hook-in-concurrent-mode/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;According to &lt;a href=&#34;https://reactjs.org/blog/2018/11/27/react-16-roadmap.html&#34;&gt;React 16.x Roadmap&lt;/a&gt;, we are expecting Concurrent Mode soon.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;React 16.x (~Q2 2019): The One with Concurrent Mode&#xA;Concurrent Mode lets React apps be more responsive by rendering component trees without blocking the main thread. It is opt-in and allows React to interrupt a long-running render (for example, rendering a new feed story) to handle a high-priority event (for example, text input or hover). Concurrent Mode also improves the user experience of Suspense by skipping unnecessary loading states on fast connections.&lt;/p&gt;</description>
    </item>
    <item>
      <title>useFetch: React custom hook for Fetch API with Suspense and Concurrent Mode in Mind</title>
      <link>https://blog.axlight.com/posts/usefetch-react-custom-hook-for-fetch-api-with-suspense-and-concurrent-mode-in-mind/</link>
      <pubDate>Mon, 04 Feb 2019 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/usefetch-react-custom-hook-for-fetch-api-with-suspense-and-concurrent-mode-in-mind/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;While I don&amp;rsquo;t feel like coding React without hooks, react-cache still seems to be still far away. Surely, caching in data fetching important, nevertheless I would like to seek possibilities of implementations only with React Hooks. These might be obsoleted in the future, but I want something today, that is &amp;ldquo;useFetch&amp;rdquo;. This could be still useful without react-cache in case sophisticated caching is not necessary.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve started developing &amp;ldquo;useFetch&amp;rdquo; as a tutorial to build a custom hook.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Playing with React Hooks and Web Workers</title>
      <link>https://blog.axlight.com/posts/playing-with-react-hooks-and-web-workers/</link>
      <pubDate>Tue, 29 Jan 2019 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/playing-with-react-hooks-and-web-workers/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;React Hooks is something I&amp;rsquo;ve been working on lately. What&amp;rsquo;s wonderful is creating custom hooks. If you encapsulate logic nicely in a hook, it can be shared among components and used intuitively. You can find my custom hooks in &lt;a href=&#34;https://github.com/dai-shi&#34;&gt;my GitHub repos&lt;/a&gt;, some of which are very experimental.&lt;/p&gt;&#xA;&lt;p&gt;This time, my experiment is to combine React Hooks and Web Workers. I know it&amp;rsquo;s not too difficult, but let me explain a bit in this short article.&lt;/p&gt;</description>
    </item>
    <item>
      <title>My first WebAssembly trial with Node.js only</title>
      <link>https://blog.axlight.com/posts/my-first-webassembly-trial-with-node-js-only/</link>
      <pubDate>Tue, 22 Jan 2019 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/my-first-webassembly-trial-with-node-js-only/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;One of the technologies we should keep eyes on in the web world is WebAssembly or wasm. As I am new to it, I won&amp;rsquo;t describe much of its fundamentals. Please visit the official web site to learn from scratch.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://webassembly.org/&#34;&gt;https://webassembly.org/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;This short article describes my first trial on wasm. What I want to try is just to run example code, but I&amp;rsquo;d start with writing the example code in wasm(wat).&lt;/p&gt;</description>
    </item>
    <item>
      <title>A thought on React Context default value</title>
      <link>https://blog.axlight.com/posts/a-thought-on-react-context-default-value/</link>
      <pubDate>Fri, 11 Jan 2019 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/a-thought-on-react-context-default-value/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;It&amp;rsquo;s been about a year since React Context API is out. This is powerful and it&amp;rsquo;s even more powerful with upcoming React Hooks API, namely &lt;code&gt;useContext&lt;/code&gt;. Please check out official documents to learn them in detail.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://reactjs.org/docs/context.html&#34;&gt;https://reactjs.org/docs/context.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://reactjs.org/docs/hooks-intro.html&#34;&gt;https://reactjs.org/docs/hooks-intro.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Now, this very short article is just about the default value of a context. When you create a context, you pass a default value in the first argument.&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;The &lt;code&gt;defaultValue&lt;/code&gt; argument is &lt;strong&gt;only&lt;/strong&gt; used when a component does not have a matching Provider above it in the tree. This can be helpful for testing components in isolation without wrapping them. Note: passing &lt;code&gt;undefined&lt;/code&gt; as a Provider value does not cause consuming components to use &lt;code&gt;defaultValue&lt;/code&gt;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Developing React custom hooks for abortable async functions with AbortController</title>
      <link>https://blog.axlight.com/posts/developing-react-custom-hooks-for-abortable-async-functions-with-abortcontroller/</link>
      <pubDate>Mon, 31 Dec 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/developing-react-custom-hooks-for-abortable-async-functions-with-abortcontroller/</guid>
      <description>&lt;p&gt;In &lt;a href=&#34;https://blog.axlight.com/posts/introduction-to-abortable-async-functions-for-react-with-hooks/&#34;&gt;my previous article&lt;/a&gt;, I introduced how the custom hook &lt;code&gt;useAsyncTask&lt;/code&gt; handles async functions with AbortController and demonstrated a typeahead search example. In this article, I explain about the implementation of &lt;code&gt;useAsyncTask&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;recap&#34;&gt;Recap&lt;/h3&gt;&#xA;&lt;p&gt;JavaScript promise is not abortable. The fetch API is based on promise, and hence you can&amp;rsquo;t cancel it in pure JavaScript. To cancel &lt;code&gt;fetch&lt;/code&gt;, the DOM spec introduced &lt;code&gt;AbortController&lt;/code&gt;. The AbortController is a general interface and not specific to &lt;code&gt;fetch&lt;/code&gt;. Technically, we can use it to cancel promises, and it would be nice to have an easy way to handle abortable async functions. In the React world, we are expecting the Hooks API soon. I&amp;rsquo;ve started a project to implement custom hooks for abortable async functions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Injecting a client-side script in GraphQL Playground in Apollo Server</title>
      <link>https://blog.axlight.com/posts/injecting-a-client-side-script-in-graphql-playground-in-apollo-server/</link>
      <pubDate>Sat, 22 Dec 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/injecting-a-client-side-script-in-graphql-playground-in-apollo-server/</guid>
      <description>&lt;p&gt;This is a short article to explain how I inject a client-side script in Playground. Note that this is a workaround solution until I find a better way.&lt;/p&gt;&#xA;&lt;h3 id=&#34;background&#34;&gt;Background&lt;/h3&gt;&#xA;&lt;p&gt;When developing a GraphQL server with Apollo Server, GraphQL Playground is a tool that you are likely to use. Now, suppose we have an Apollo server that authenticates with a token in an HTTP header. Luckily, Playground has an editor to specify HTTP headers. However, what if we need to call OAuth provider to get an accessToken? Surely, we could run &lt;code&gt;curl&lt;/code&gt; to get a token, copy it in the terminal and paste it in the browser. It should be much easier if we could simply sign in in the browser.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Developing React custom hooks for Redux without react-redux</title>
      <link>https://blog.axlight.com/posts/developing-react-custom-hooks-for-redux-without-react-redux/</link>
      <pubDate>Fri, 14 Dec 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/developing-react-custom-hooks-for-redux-without-react-redux/</guid>
      <description>&lt;h3 id=&#34;background&#34;&gt;Background&lt;/h3&gt;&#xA;&lt;p&gt;Ever since I learned Redux, I&amp;rsquo;ve been thinking an alternative integration of react and redux to the official react-redux library. The intuition behind it is that Redux is super simple which I like a lot, whereas react-redux is complex because of performance tuning. If you are developing a business product, the official react-redux is to go without a doubt, but if you are playing with creating a toy app or you are just starting learning Redux, you might want something more straightforward.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Introduction to abortable async functions for React with hooks</title>
      <link>https://blog.axlight.com/posts/introduction-to-abortable-async-functions-for-react-with-hooks/</link>
      <pubDate>Tue, 11 Dec 2018 10:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/introduction-to-abortable-async-functions-for-react-with-hooks/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;There is a follow-up article which describes the implementation details of the library. Please visit &lt;a href=&#34;https://blog.axlight.com/posts/developing-react-custom-hooks-for-abortable-async-functions-with-abortcontroller/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;h3 id=&#34;tldr&#34;&gt;TL;DR&lt;/h3&gt;&#xA;&lt;p&gt;Just visit the &lt;a href=&#34;https://codesandbox.io/s/github/dai-shi/react-hooks-async/tree/master/examples/04_typeahead&#34;&gt;example&lt;/a&gt; in codesandbox and try it.&lt;/p&gt;&#xA;&lt;h3 id=&#34;background&#34;&gt;Background&lt;/h3&gt;&#xA;&lt;p&gt;You can&amp;rsquo;t cancel promises in JavaScript and that&amp;rsquo;s one of the reason why libraries such as redux-saga and redux-observables are popular because they allow cancellation. While they are good solutions as well as Redux is, there might be a case when you want just a cancellation mechanism for a promise, not the entire framework. As is noted JavaScript doesn&amp;rsquo;t have cancellation mechanism, but DOM has it. It&amp;rsquo;s called &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/AbortController&#34;&gt;AbortController&lt;/a&gt;. It&amp;rsquo;s only supported in recent browsers, but polyfills should help for old browsers and Node.js.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Creating a Minimal Expo React Native Project with TypeScript and Jest</title>
      <link>https://blog.axlight.com/posts/creating-a-minimal-expo-react-native-project-with-typescript-and-jest/</link>
      <pubDate>Sat, 01 Dec 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/creating-a-minimal-expo-react-native-project-with-typescript-and-jest/</guid>
      <description>&lt;p&gt;This article shows the steps to create a minimal Expo project. The project uses TypeScript and Jest. Note that this procedure is based on Expo SDK31 and may be invalid in the future.&lt;/p&gt;&#xA;&lt;h3 id=&#34;install-expo-cli&#34;&gt;Install Expo CLI&lt;/h3&gt;&#xA;&lt;p&gt;As described in &lt;a href=&#34;https://docs.expo.io/versions/v31.0.0/introduction/installation&#34;&gt;the official doc&lt;/a&gt;, let&amp;rsquo;s install the CLI tool.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ npm install -g expo-cli&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;blockquote&gt;&#xA;&lt;p&gt;Note: I prefer using &lt;code&gt;npx&lt;/code&gt; and I use &lt;code&gt;npx&lt;/code&gt; in my project, but &lt;code&gt;expo-cli&lt;/code&gt; depends on &lt;code&gt;@expo/dev-tools&lt;/code&gt; which depends on old &lt;code&gt;graphql&lt;/code&gt;. It&amp;rsquo;s just safer to do global install unless you know the issues that could arise.&lt;/p&gt;</description>
    </item>
    <item>
      <title>React Hooks Tutorial on Developing a Custom Hook for Data Fetching</title>
      <link>https://blog.axlight.com/posts/react-hooks-tutorial-on-developing-a-custom-hook-for-data-fetching/</link>
      <pubDate>Thu, 29 Nov 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/react-hooks-tutorial-on-developing-a-custom-hook-for-data-fetching/</guid>
      <description>&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;React Hooks are a new feature coming in React 16.7. It allows us to write stateful function components that were impossible before without class components. The official docs are must-read, so check them out if you haven&amp;rsquo;t.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://reactjs.org/docs/hooks-intro.html&#34;&gt;https://reactjs.org/docs/hooks-intro.html&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Besides stateful function components, this new feature allow us to build a custom hook to share logic between components. This has been possible with High-order Components (HoCs), and although there&amp;rsquo;s technically no difference what hooks can achieve, hooks simplify it a lot and reduce so called &amp;ldquo;wrapper hell&amp;rdquo;. This simplicity encourages building custom hooks, and this trend reminds me of npm&amp;rsquo;s early days.&lt;/p&gt;</description>
    </item>
    <item>
      <title>A deadly simple React bindings library for Redux with Hooks API</title>
      <link>https://blog.axlight.com/posts/a-deadly-simple-react-bindings-library-for-redux-with-hooks-api/</link>
      <pubDate>Fri, 16 Nov 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/a-deadly-simple-react-bindings-library-for-redux-with-hooks-api/</guid>
      <description>&lt;blockquote&gt;&#xA;&lt;p&gt;There is a follow-up article which describes the implementation details of this library. Please visit &lt;a href=&#34;https://blog.axlight.com/posts/developing-react-custom-hooks-for-redux-without-react-redux/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;Redux is one of the popular libraries for React. Although Redux itself is not tied to React, it&amp;rsquo;s often used with the official bindings &lt;code&gt;react-redux&lt;/code&gt; that allows to connect Redux state to any React components.&lt;/p&gt;&#xA;&lt;p&gt;In this article, we propose another bindings library to combine React and Redux. This library tries to be simple and easy for beginners. As of writing, this is still an experimental project and feedbacks are welcome.&lt;/p&gt;</description>
    </item>
    <item>
      <title>React Hooks Tutorial on pure useReducer &#43; useContext for global state like Redux and comparison with react-hooks-global-state</title>
      <link>https://blog.axlight.com/posts/react-hooks-tutorial-for-pure-usereducer-usecontext-for-global-state-like-redux-and-comparison/</link>
      <pubDate>Fri, 09 Nov 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/react-hooks-tutorial-for-pure-usereducer-usecontext-for-global-state-like-redux-and-comparison/</guid>
      <description>&lt;p&gt;In this article, I will first explain minimal code to implement global state with useReducer and useContext which are called &amp;ldquo;hooks&amp;rdquo; that will be available in React 16.7. I will then compare it with &lt;a href=&#34;https://github.com/dai-shi/react-hooks-global-state&#34;&gt;react-hooks-global-state&lt;/a&gt; which is a tiny library that I&amp;rsquo;ve been developing for global state management primarily for small applications.&lt;/p&gt;&#xA;&lt;p&gt;Note: Global state is convenient for sharing values among components far apart in the component tree, but it shouldn&amp;rsquo;t be abused because it would limit the reusability. Consider if values could be simply passed as props down the component tree.&lt;/p&gt;</description>
    </item>
    <item>
      <title>React global state by Context API for TypeScript</title>
      <link>https://blog.axlight.com/posts/react-global-state-by-context-api-for-typescript/</link>
      <pubDate>Thu, 08 Nov 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/react-global-state-by-context-api-for-typescript/</guid>
      <description>&lt;p&gt;&lt;em&gt;Note: this post has nothing to do with React Hooks API.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;p&gt;In &lt;a href=&#34;https://blog.axlight.com/posts/react-global-state-by-context-api/&#34;&gt;my previous post&lt;/a&gt;, I introduced a library called react-context-global-state. After a while, I have better knowlege of TypeScript (yes, I&amp;rsquo;m a beginner!), and come up with fairly good type definitions. I just released a new version.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://www.npmjs.com/package/react-context-global-state&#34;&gt;https://www.npmjs.com/package/react-context-global-state&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h3 id=&#34;example-code-in-typescript&#34;&gt;Example code in TypeScript&lt;/h3&gt;&#xA;&lt;p&gt;Let me breifly show how the code looks like in TypeScript.&lt;/p&gt;&#xA;&lt;p&gt;In a file named state.ts, we define a global state and export function components. The &lt;code&gt;State&lt;/code&gt; type is also exported.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Redux middleware compatible React Hooks library for easy global state management</title>
      <link>https://blog.axlight.com/posts/redux-middleware-compatible-react-hooks-library-for-easy-global-state-management/</link>
      <pubDate>Wed, 07 Nov 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/redux-middleware-compatible-react-hooks-library-for-easy-global-state-management/</guid>
      <description>&lt;h3 id=&#34;the-library&#34;&gt;The library&lt;/h3&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve been developing a library to make use of React Hooks API. The library is for global state mangement with the aim to use it instead of Redux, especially for smaller applications. See the repository for more information and the source code.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/dai-shi/react-hooks-global-state&#34;&gt;https://github.com/dai-shi/react-hooks-global-state&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Please also check out my previous posts&#xA;[&lt;a href=&#34;https://blog.axlight.com/posts/typescript-aware-react-hooks-for-global-state/&#34;&gt;1&lt;/a&gt;]&#xA;[&lt;a href=&#34;https://blog.axlight.com/posts/an-alternative-to-react-redux-by-react-hooks-api-for-both-javascript-and-typescript/&#34;&gt;2&lt;/a&gt;].&lt;/p&gt;&#xA;&lt;h3 id=&#34;support-for-redux-middleware&#34;&gt;Support for Redux middleware&lt;/h3&gt;&#xA;&lt;p&gt;Originally, the library was extending useState for global state. Later, reducer is supported. Now, middleware support is added. The following is the code snippet from the working example to illustrate how it can be used.&lt;/p&gt;</description>
    </item>
    <item>
      <title>An alternative to React Redux by React Hooks API (For both JavaScript and TypeScript)</title>
      <link>https://blog.axlight.com/posts/an-alternative-to-react-redux-by-react-hooks-api-for-both-javascript-and-typescript/</link>
      <pubDate>Sun, 04 Nov 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/an-alternative-to-react-redux-by-react-hooks-api-for-both-javascript-and-typescript/</guid>
      <description>&lt;h3 id=&#34;motivation&#34;&gt;Motivation&lt;/h3&gt;&#xA;&lt;p&gt;Everyone is excited about the new React Hooks API. So am I. Having been thinking how to manage global state, the Hooks API seems promising. By the way, I like Redux a lot, but I don&amp;rsquo;t like react-redux a.k.a &lt;code&gt;connect&lt;/code&gt; very much. It is too complicated for beginners to use it properly. For example, reselect / memoization is a hard concept to explain. My recommendation is to structure a global state so that &lt;code&gt;mapStateToProps&lt;/code&gt; only needs to select a part of the state without any logic. If you are really free to structure a global state, you can make it so that it selects direct properties of the state, which means &amp;ldquo;one-depth&amp;rdquo;.&lt;/p&gt;</description>
    </item>
    <item>
      <title>TypeScript-aware React hooks for global state</title>
      <link>https://blog.axlight.com/posts/typescript-aware-react-hooks-for-global-state/</link>
      <pubDate>Sun, 28 Oct 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/typescript-aware-react-hooks-for-global-state/</guid>
      <description>&lt;p&gt;React Hooks API is a new proposal for React v16.7. It enables writing all components as functions with full functionality. You can develop &amp;ldquo;custom hooks&amp;rdquo; to add a new functionality. Although it&amp;rsquo;s not released yet, I would like to introduce a new library to support global state. Note that it&amp;rsquo;s still an experiment.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-library&#34;&gt;The library&lt;/h3&gt;&#xA;&lt;p&gt;It&amp;rsquo;s called &amp;ldquo;react-hooks-global-state&amp;rdquo; and is available in npm. Please also checkout the GitHub repository.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/dai-shi/react-hooks-global-state&#34;&gt;https://github.com/dai-shi/react-hooks-global-state&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Clean Expo (React Native) &#43; React Apollo (GraphQL) &#43; TypeScript boilerplate</title>
      <link>https://blog.axlight.com/posts/clean-expo-react-native-react-apollo-graphql-typescript-boilerplate/</link>
      <pubDate>Sat, 20 Oct 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/clean-expo-react-native-react-apollo-graphql-typescript-boilerplate/</guid>
      <description>&lt;h3 id=&#34;motivation&#34;&gt;Motivation&lt;/h3&gt;&#xA;&lt;p&gt;Have you heard of React Native, GraphQL and TypeScript? I&amp;rsquo;m looking for a easy and nice tech stack to develop mobile apps. These three may fit nicely for developing mobile apps for beginners up to intermediates. More precisely, Expo is chosen for building React Native development environment, and React Apollo is for GraphQL. These libraries comes with type annotations, which allow us to code in TypeScript. By &amp;ldquo;Clean&amp;rdquo; I mean not only the boilerplate is minimalistic, but also we don&amp;rsquo;t allow &amp;ldquo;any&amp;rdquo; types.&lt;/p&gt;</description>
    </item>
    <item>
      <title>React global state by Context API</title>
      <link>https://blog.axlight.com/posts/react-global-state-by-context-api/</link>
      <pubDate>Fri, 05 Oct 2018 12:00:00 +0900</pubDate>
      <guid>https://blog.axlight.com/posts/react-global-state-by-context-api/</guid>
      <description>&lt;p&gt;I had been trying to find a way to use React without using class. Redux is one solution to achieve this. Although I love the idea of writing everthing in pure functions, Redux is sometimes not suitable for small apps. React v16.3 introduced new Context API officially. Since then, several ideas were proposed to use it for managing global state. So far, I wasn&amp;rsquo;t able to find something I really liked, hence I made a new one.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
