<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jeremy on Medium]]></title>
        <description><![CDATA[Stories by Jeremy on Medium]]></description>
        <link>https://medium.com/@suhaotian?source=rss-4f6f2b75e414------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*I_NGWYmaID3f0v1-af-Oqg.png</url>
            <title>Stories by Jeremy on Medium</title>
            <link>https://medium.com/@suhaotian?source=rss-4f6f2b75e414------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 08:32:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@suhaotian/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[tsdkbundle: A Bun-Based TypeScript Multi-Entry Bundler]]></title>
            <link>https://suhaotian.medium.com/tsdkbundle-a-bun-based-typescript-multi-entry-bundler-287630547c43?source=rss-4f6f2b75e414------2</link>
            <guid isPermaLink="false">https://medium.com/p/287630547c43</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[buns]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[tsdkarc]]></category>
            <dc:creator><![CDATA[Jeremy]]></dc:creator>
            <pubDate>Thu, 06 Aug 2026 00:44:52 GMT</pubDate>
            <atom:updated>2026-08-06T00:51:02.423Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern TypeScript backend projects often contain more than one entry point.</p><p>Besides HTTP API services, a project may include workers, scheduled tasks, CLI tools, database migration scripts, and other standalone modules.</p><p>Managing each entry separately usually means maintaining multiple startup scripts, watch processes, and build configurations. As the project grows, these configurations become repetitive and harder to maintain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s4qhEqU6Y7fXX6bfu-LVKw.png" /><figcaption>tsdkbundle workflow</figcaption></figure><p><a href="https://github.com/tsdk-monorepo/tsdkarc/tree/main/tsdkbundle#tsdkbundle">tsdkbundle</a> was created to simplify this workflow.</p><p>It is a Bun-based ESM bundler and watcher designed for TypeScript multi-entry projects:</p><ul><li>Manage multiple entry points with a single configuration file</li><li>Watch files and restart processes during development</li><li>Build multiple entries consistently for production</li><li>Native support for ESM and TypeScript (Otherwise @nestjs/cli is good for commonjs projects)</li><li>Fast builds powered by Bun</li></ul><p>For example, a backend project:</p><pre>src/<br>├── index.ts              # API service<br>├── worker.ts             # Async worker<br>└── scripts/<br>    └── migrate.ts        # Database migration</pre><p>Configure the project bundle.config.ts:</p><pre>export default {<br>  projects: {<br>    backend: {<br>      target: &quot;node&quot;,<br>      entry: [&quot;src/index.ts&quot;, &quot;src/worker.ts&quot;, &quot;src/scripts/migrate.ts&quot;],<br>    },<br>  },<br>};</pre><p>Run in development mode:</p><pre>bundle dev backend</pre><p>Build for production:</p><pre>bundle build backend</pre><p>Install now:</p><pre>npm i tsdkbundle -D</pre><h3>Why Bun?</h3><p>Bun already provides TypeScript support, ESM support, and a fast bundler.</p><p>However, application projects still need to handle common tasks such as:</p><ul><li>Managing multiple entry points</li><li>Running development processes</li><li>Watching source files</li><li>Restarting services after changes</li><li>Building multiple projects together</li></ul><p>tsdkbundle focuses on simplifying these workflows.</p><p>It does not replace Bun. It provides a project-level workflow on top of Bun for TypeScript applications.</p><h3>Use Cases</h3><p>tsdkbundle is designed for:</p><ul><li>TypeScript backend projects</li><li>Node.js services</li><li>Applications with multiple runtime entry points</li></ul><p>It is not intended to replace frontend tools like Vite or Next.js. Instead, it focuses on a specific problem:</p><blockquote><em>Making multi-entry development, execution, and building for TypeScript projects easier.</em></blockquote><p>As the ecosystem moves toward ESM, TypeScript, and Bun, development workflows need tools that fit these environments.</p><p>tsdkbundle aims to be a simple and focused tool for managing TypeScript multi-entry projects.</p><p>Check it today 👉 <a href="https://github.com/tsdk-monorepo/tsdkarc/tree/main/tsdkbundle#tsdkbundle">https://github.com/tsdk-monorepo/tsdkarc/blob/main/tsdkbundle</a></p><figure><img alt="banner" src="https://cdn-images-1.medium.com/max/896/1*Xkgid96tAaUwCJ5DmQK8jg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=287630547c43" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Xior.js is the best axios alternatives]]></title>
            <link>https://suhaotian.medium.com/why-xior-js-is-the-best-axios-alternatives-d5d6be5c1069?source=rss-4f6f2b75e414------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5d6be5c1069</guid>
            <category><![CDATA[axios]]></category>
            <category><![CDATA[fetch-api]]></category>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[xior]]></category>
            <dc:creator><![CDATA[Jeremy]]></dc:creator>
            <pubDate>Fri, 03 Apr 2026 09:37:51 GMT</pubDate>
            <atom:updated>2026-04-03T09:37:51.276Z</atom:updated>
            <content:encoded><![CDATA[<p>Xior.js is the best axios alternative library, Because Three Reasons:</p><ol><li><strong>Similar Syntax</strong></li></ol><pre>import axios, {merge as deepMerge} from &#39;xior&#39; // 👈 that&#39;s it<br><br>// create instance<br>const instance = axios.create({<br>  baseURL: &#39;https://some-domain.com/api/&#39;,<br>  timeout: 1000,<br>  headers: { &#39;X-Custom-Header&#39;: &#39;foobar&#39; },<br>});<br><br>// GET<br>axios.get(&#39;/user?ID=12345&#39;);<br>axios.get(&#39;/user&#39;, {<br>  params: {<br>    ID: 12345,<br>  },<br>});<br><br>// POST<br>axios.post(&#39;/user&#39;, {<br>  firstName: &#39;Fred&#39;,<br>  lastName: &#39;Flintstone&#39;,<br>});<br><br>// interceptors<br>instance.interceptors.request.use((config) =&gt; {<br>  const token = localStorage.getItem(&#39;REQUEST_TOKEN&#39;);<br>  if (!token) return config;<br><br>  return deepMerge(config, {<br>    headers: {<br>      Authorization: `Bearer ${token}`,<br>    },<br>  });<br>});</pre><p><strong>2. Tiny ~3KB in GZIP, Using Fetch and Write in TypeScript, Type safe and lightweight</strong></p><figure><img alt="https://bundlephobia.com/package/xior@0.8.3" src="https://cdn-images-1.medium.com/max/944/1*j5w92Rg5Q1VG2rjaqNwlpw.png" /></figure><p>3. <strong>Built-in rich plugins and supports nested query encoding without needing the qs module.</strong></p><p><strong>Xior.js</strong> supports many useful plugins: cache, error retry, dedupe, throttle…<br>It also supports <strong>nested query encoding out of box without </strong>requiring the `<strong>qs`</strong> module.</p><p><strong>Try it today 👉</strong>: <a href="https://github.com/suhaotian/xior">https://github.com/suhaotian/xior</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5d6be5c1069" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why You Shouldn’t Implement Pull-to-Refresh in Web Apps (and the Only Exception)]]></title>
            <link>https://javascript.plainenglish.io/why-you-shouldnt-implement-pull-to-refresh-in-web-apps-and-the-only-exception-fb85e92674a3?source=rss-4f6f2b75e414------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb85e92674a3</guid>
            <category><![CDATA[pull-to-refresh]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ux]]></category>
            <dc:creator><![CDATA[Jeremy]]></dc:creator>
            <pubDate>Thu, 26 Feb 2026 04:27:24 GMT</pubDate>
            <atom:updated>2026-02-26T04:27:24.285Z</atom:updated>
            <content:encoded><![CDATA[<h4>In mobile UI design, “Pull-to-Refresh” is a hallmark native app interaction. Yet in web development, blindly replicating it often becomes a double trap for performance and user experience.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AuEq-UJDbyL1VvTWEzayrQ.jpeg" /><figcaption>No pull-to-refresh in browser web pabes</figcaption></figure><h3>1. Conflict with Browser Native Features</h3><p>Modern mobile browsers, such as iOS Safari and Android Chrome, already have a built-in global pull-to-refresh mechanism.</p><ul><li><strong>Reinventing the wheel:</strong> The native browser behavior is not only smooth (rendered at the system level) but also aligns with users’ global habits.</li><li><strong>Visual disaster:</strong> If developers implement a custom pull-to-refresh inside the page, user actions can trigger both the browser’s bounce effect and the custom loading animation simultaneously, causing violent page shakes or double loading indicators, which severely undermines consistency.</li></ul><h3>2. Over-complicating the Interaction</h3><p>Creating a smooth pull-to-refresh experience is not trivial.</p><ul><li><strong>Performance cost:</strong> On the web, listening to touchmove events and updating the DOM in real time consumes significant resources. Even using transform acceleration rarely achieves the silky damping feel of a native app.</li><li><strong>Unexpected triggers:</strong> Web users primarily scroll to read. When a user simply wants to reach the top of the page quickly, they may accidentally trigger pull-to-refresh, losing their reading progress or forcing a reload. Such “unexpected behavior” is a major UX pitfall.</li></ul><h3>3. Fundamental Differences Between Web and Native</h3><p>Native apps often require pull-to-refresh because they operate as “closed containers.”</p><ul><li><strong>Native limitations:</strong> Apps have no address bar or physical refresh button. If data freezes or fails to update, users must pull to refresh; otherwise, the only option is force-closing the app.</li><li><strong>Web advantages:</strong> Browsers already provide comprehensive navigation and refresh tools.</li></ul><h3>4. The Only Exception: WebView (Embedded in an App)</h3><p>While it’s generally discouraged on normal web pages, if your web page runs inside an <strong>App WebView</strong>, the conclusion is entirely different: <strong>you could implement it.</strong></p><p>In an embedded environment (such as webview or other app containers), the browser’s native toolbar is usually hidden, and users perceive your page as part of the app.</p><ul><li><strong>Functional necessity:</strong> Users lose access to the refresh button, making pull-to-refresh the only “lifeline.”</li><li><strong>Psychological expectation:</strong> Inside an app, users expect a “pullable” response. Without pull-to-refresh, the app feels rigid or even disconnected from the network.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb85e92674a3" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/why-you-shouldnt-implement-pull-to-refresh-in-web-apps-and-the-only-exception-fb85e92674a3">Why You Shouldn’t Implement Pull-to-Refresh in Web Apps (and the Only Exception)</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best Axios Alternatives in 2026: The Showdown]]></title>
            <link>https://suhaotian.medium.com/best-axios-alternatives-in-2026-the-showdown-71a10c0850e3?source=rss-4f6f2b75e414------2</link>
            <guid isPermaLink="false">https://medium.com/p/71a10c0850e3</guid>
            <category><![CDATA[fetch-api]]></category>
            <category><![CDATA[http-client]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[axios-vs-fetch]]></category>
            <category><![CDATA[axios]]></category>
            <dc:creator><![CDATA[Jeremy]]></dc:creator>
            <pubDate>Wed, 25 Feb 2026 06:59:06 GMT</pubDate>
            <atom:updated>2026-02-25T06:59:06.971Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s 2026. Axios is still legendary — the “GOAT” of HTTP clients. But let’s be real: Great developers always crave fresh, efficient tools.</p><figure><img alt="Axios alternatives in 2026" src="https://cdn-images-1.medium.com/max/1024/1*pI7BXZSG46MHk42akScdbQ.jpeg" /></figure><p>Today we are in vibe coding era , we can easily use Claude Code or CodeX to generate a lite fetch wrapper.</p><p>Or if you are looking to some already exists awesome fetch wrapper libs, here are the best replacements. We are judging on <strong>Size</strong>, <strong>Features</strong>, and <strong>API Syntax</strong>.</p><h4>KY</h4><p>The earliest fetch wrapper, created by Sindre Sorhus (the author of `got`). It’s robust, reliable, and sets the standard for modern fetch usage. Size in <strong>gzip ~5kb .</strong></p><p>GitHub: <a href="https://github.com/sindresorhus/ky">https://github.com/sindresorhus/ky</a></p><h4><strong>Wretch</strong></h4><p>The tiniest fetch wrapper out there. It uses a chainable syntax that feels very different from Axios but is incredibly sweet to write once you get used to it. Size in <strong>gzip ~2kb .</strong></p><p>GitHub: <a href="https://github.com/elbywan/wretch">https://github.com/elbywan/wretch</a></p><h4><strong>Ofetch</strong></h4><p>The fetch wrapper from the Nuxt/Vue ecosystem. Size in <strong>gzip ~6kb .</strong></p><p>GitHub: <a href="https://github.com/unjs/ofetch">https://github.com/unjs/ofetch</a></p><h4><strong>Redaxios</strong></h4><p>The axios like API, Size less than 1KB! But it doesn’t support good TypeScript and lack of axios features support like axios interceptors or plugins.</p><p>GitHub: <a href="https://github.com/developit/redaxios">https://github.com/developit/redaxios</a></p><h4><strong>Xior.js</strong></h4><p>The closest experience to Axios. supports <strong>interceptors/plugins,</strong> and has <strong>built-in nested query encoding</strong>. If you want Axios muscle without the fat, this is it. Size in ~<strong>3KB</strong> gzipped.</p><p>GitHub: <a href="https://github.com/suhaotian/xior">https://github.com/suhaotian/xior</a></p><pre>import axios from &#39;xior&#39;;<br><br>const client = axios.create({<br>   baseURL: &#39;...&#39;<br>})<br>client.interceptors.request.use((config) =&gt; {<br>  if (config.url === &#39;/endpoint&#39;) {<br>    delete config.headers[&#39;Content-Type&#39;];<br>  }<br>  return config;<br>});</pre><h3><strong>What’s your pick?</strong></h3><p>Here is the my personal suggestions:</p><ul><li><strong>Best for Efficiency:</strong> If you need a balance of tiny bundle size and rich features, go with <strong>wretch</strong>.</li><li><strong>Best for Legacy:</strong> If you’re already using <strong>axios</strong> in an older project, don’t break what works — keep using it.</li><li><strong>The Modern “Axios”:</strong> If you want lightweight performance but love the Axios syntax, <strong>xior.js</strong> is the winner.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71a10c0850e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building High-Performance Scroll Restoration Infinite Lists on the Web]]></title>
            <link>https://javascript.plainenglish.io/building-high-performance-scroll-restoration-infinite-lists-on-the-web-baa55d4cd52f?source=rss-4f6f2b75e414------2</link>
            <guid isPermaLink="false">https://medium.com/p/baa55d4cd52f</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[infinite-list]]></category>
            <category><![CDATA[infinite-scroll]]></category>
            <category><![CDATA[scroll-restoration]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Jeremy]]></dc:creator>
            <pubDate>Wed, 25 Feb 2026 00:14:13 GMT</pubDate>
            <atom:updated>2026-03-17T12:15:40.271Z</atom:updated>
            <content:encoded><![CDATA[<p>A user is scrolling deep into an infinite feed. They see something interesting, click it, read the details, and hit “Back.”</p><p><strong>Boom</strong>. They are thrown right back to the top of the page. Everything resets. The immersion is shattered.</p><p>On native apps (iOS, Android,React Native, Flutter), this “just works.” The system freezes the previous view in a stack — scroll position, memory, and all. On the Web? We have to fight for it.</p><p>— -</p><p><strong>In the Web world, we generally have two navigation models:</strong></p><p><strong>**The first approach**</strong> is to keep the list alive and open the detail view on top (via a modal or overlay).</p><p>The list component never unmounts, and the DOM is never destroyed, so the scroll position and internal virtual list state are naturally preserved. When closing the details, the interface is exactly where it was left, requiring no restoration logic and avoiding scroll jumping or data reconstruction.</p><p>- <strong>Pros:</strong> Simple, stable, and feels the closest to a native app.</p><p>- <strong>Cons:</strong> Navigation semantics require extra effort — URLs, browser back/forward buttons, and deep links must be manually managed.</p><p>— -</p><p><strong>*The second approach**</strong> is standard route navigation.</p><p>When entering the detail page, we saves the list’s state (scrollTop, loaded page numbers, or cached data) to restore it later.</p><p>- <strong>Pros:</strong> This aligns with the standard Web navigation model, offering native support for URLs, refreshing, sharing, and direct access.</p><p>- <strong>Cons:</strong> If the list data is massive, returning may cause a blank flash or a “frozen” feeling. If using a virtual list, the internal window state must be perfectly synchronized, or the restored position will drift or offset.</p><p>— -</p><blockquote><strong><em>Which approach do you prefer? Or do you have a better solution?</em></strong></blockquote><blockquote>— -</blockquote><p>I recently built a <strong>bidirectional infinite scroll component</strong> (supporting both React and Vue). What sets this apart from traditional infinite scrolls is that it not only supports bidirectional loading but also <strong>renders only a fixed number of DOM nodes</strong>. Based on this component, I built a demo to experiment with this scroll-restoration interaction.</p><p><strong>But How did I achieve this?</strong></p><p>I utilized the second approach (<strong>standard routing with state recording</strong>). By saving the `scrollTop`, and cached data, I can restore the view. Because the component natively supports rendering a fixed number of items, performance is excellent. Crucially, unlike many virtual scrolling libraries, it <strong>does not require fixed item heights</strong>.</p><p>If you are interested:</p><p>🚀 Try it yourself: <a href="https://suhaotian.github.io/broad-infinite-list/?demo=news"><strong>Live Demo</strong></a></p><p>💻 Read the Code: <a href="https://github.com/suhaotian/broad-infinite-list/blob/main/demos/src/demos/news-feed/news-feed-list.tsx"><strong>Source Code</strong></a></p><p>— — -</p><p><em>_Note: The Demo Works perfectly on my machine! If it acts weird on your specific device or browsers, drop a comment or an issue — I’d love to squash those bugs._</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baa55d4cd52f" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/building-high-performance-scroll-restoration-infinite-lists-on-the-web-baa55d4cd52f">Building High-Performance Scroll Restoration Infinite Lists on the Web</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bidirectional Infinite Scroll List component for Large List and support React, Vue 3, RN]]></title>
            <link>https://javascript.plainenglish.io/bidirectional-infinite-scroll-component-for-react-vue-3-rn-9b96a3787a1c?source=rss-4f6f2b75e414------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b96a3787a1c</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[infinite-scroll]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[bidirectional]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Jeremy]]></dc:creator>
            <pubDate>Sun, 08 Feb 2026 23:14:40 GMT</pubDate>
            <atom:updated>2026-02-26T09:08:43.130Z</atom:updated>
            <content:encoded><![CDATA[<p>I always want a component for a large list with only show fixed items. When we scroll to the top, it loads more items. If the new list exceeds N items (for example, N = 30), the extra items at the bottom are removed.</p><p>The same happens when we scroll to the bottom: it loads more items, and if the list exceeds N, the extra items at the top are removed.</p><figure><img alt="How broad-infinite-list works" src="https://cdn-images-1.medium.com/max/1024/1*ZnzAke2kceTL-92qIdPeWg.png" /><figcaption>How it works</figcaption></figure><p>The component should not depend on the height of items. Fixed amount items are always rendered, keeping the visible list short. It is intended to be a simple, bidirectional infinite scroll loader component.</p><p><a href="https://github.com/suhaotian/broad-infinite-list">broad-infinite-list</a> is a new component:</p><ul><li>Size only ~2KB(GZIP)</li><li>Support React, React Native(Expo), Vue 3</li><li>bidirectional infinite list</li><li>No fixed height for children elements</li></ul><p><strong>Check Demos:</strong></p><ul><li>Claude theme <a href="https://suhaotian.github.io/broad-infinite-list?demo=claude">Demo</a></li><li>News feed <a href="https://suhaotian.github.io/broad-infinite-list?demo=news">Demo</a></li><li>Vue Chat <a href="https://suhaotian.github.io/broad-infinite-list/vue?demo=chat">Demo</a></li><li>ChatGPT <a href="https://suhaotian.github.io/broad-infinite-list?demo=chatgpt">Demo</a></li></ul><h3>Comparison with other popular libraries</h3><p>Actually, <a href="https://www.npmjs.com/package/broad-infinite-list">broad-infinite-list</a> is totally different from TanStack Virtual and React Virtuoso. TanStack Virtual and React Virtuoso are more similar. Anyway, here is the comparison table:</p><figure><img alt="infinite list component compare: broad-infinite-list vs tanstak virtual vs react virtuoso" src="https://cdn-images-1.medium.com/max/1024/1*wspjFvncILonzbT74kjFbg.png" /><figcaption>Compare table</figcaption></figure><h4>If you find any problem or issues, please create issues at <a href="https://github.com/suhaotian/broad-infinite-list/issues">here</a>.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b96a3787a1c" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/bidirectional-infinite-scroll-component-for-react-vue-3-rn-9b96a3787a1c">Bidirectional Infinite Scroll List component for Large List and support React, Vue 3, RN</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[useNextTick for React]]></title>
            <link>https://suhaotian.medium.com/usenexttick-for-react-70c46dbb19a3?source=rss-4f6f2b75e414------2</link>
            <guid isPermaLink="false">https://medium.com/p/70c46dbb19a3</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nexttick]]></category>
            <category><![CDATA[useeffect]]></category>
            <category><![CDATA[react-hook]]></category>
            <dc:creator><![CDATA[Jeremy]]></dc:creator>
            <pubDate>Fri, 06 Feb 2026 23:01:04 GMT</pubDate>
            <atom:updated>2026-02-06T23:06:30.217Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Why we need this hook?</strong></h3><p>Sometimes we need to read layout, measure elements, or access refs right after a state change — but React updates asynchronously. nextTick gives you a simple way to schedule code that runs after React commits your changes. Code on <a href="https://github.com/suhaotian/use-next-tick">Github</a></p><h3><strong>Basic Usage:</strong></h3><p>Wrap code in nextTick’s callback after setState :</p><pre>import { useState, useRef } from &quot;react&quot;;<br>import useNextTick from &quot;use-next-tick&quot;;<br><br>function MyComponent() {<br>  const [count, setCount] = useState(0);<br>  const ref = useRef&lt;HTMLSpanElement&gt;(null);<br>  const nextTick = useNextTick();<br><br>  const handleClick = () =&gt; {<br>    setCount((c) =&gt; c + 1);<br>    nextTick(() =&gt; {<br>      console.log(ref.current?.textContent); // &quot;1&quot; ✓<br>    });<br>  };<br><br>  return &lt;span ref={ref}&gt;{count}&lt;/span&gt;;<br>}</pre><p>If <strong>without </strong>nextTick, we need extra useEffect or use setTimeout:</p><pre>import { useState, useRef } from &quot;react&quot;;<br><br>function MyComponent() {<br>  const [count, setCount] = useState(0);<br>  const ref = useRef&lt;HTMLSpanElement&gt;(null);<br><br>  const handleClick = () =&gt; {<br>    setCount((c) =&gt; c + 1);<br>  };<br><br>  useEffect(() =&gt; {<br>    // Runs after EVERY count change, not just from handleClick<br>    console.log(ref.current?.textContent);<br>  }, [count]);<br><br>  return &lt;span ref={ref}&gt;{count}&lt;/span&gt;;<br>}</pre><p>A React hook for running callbacks after the DOM or native views have updated. <strong>Try it today</strong>: <a href="https://github.com/suhaotian/use-next-tick">https://github.com/suhaotian/use-next-tick</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70c46dbb19a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zustand — no need to manually write the store interface anymore!]]></title>
            <link>https://javascript.plainenglish.io/zustand-no-need-to-manually-write-the-store-interface-anymore-fc68eb788582?source=rss-4f6f2b75e414------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc68eb788582</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[zustand]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Jeremy]]></dc:creator>
            <pubDate>Wed, 08 Oct 2025 12:35:52 GMT</pubDate>
            <atom:updated>2025-10-15T15:14:20.632Z</atom:updated>
            <content:encoded><![CDATA[<h3>Zustand — no need to manually write the store interface anymore!</h3><p>Before:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nzVV12WTqS3TEGITHiP6CQ.png" /><figcaption>before</figcaption></figure><p>Now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4u2hGJjslC3XCcYtbKUYAQ.png" /><figcaption>after</figcaption></figure><p>What if the fields in <em>initialState</em> are <strong>null</strong>, <strong>undefined</strong>, <strong>union</strong> types, or <strong>string</strong>? We can use TypeScript’s <strong>as</strong> syntax to fix this issue and avoid rewriting the store’s type. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AVt6s51SyJIjqxRHo_O_sg.png" /><figcaption>enhancement</figcaption></figure><p><strong>✨ Why it’s better?</strong></p><p>1.No need to manually define and sync the interface</p><p>2.Actions are separated and can grow freely</p><p>3.typeof initialState automatically infers the correct types</p><p>4.Cleaner, easier to maintain, and still fully typed</p><h3>A message from our Founder</h3><p><strong>Hey, </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>Sunil</strong></a><strong> here.</strong> I wanted to take a moment to thank you for reading until the end and for being a part of this community.</p><p>Did you know that our team run these publications as a volunteer effort to over 3.5m monthly readers? <strong>We don’t receive any funding, we do this to support the community. ❤️</strong></p><p>If you want to show some love, please take a moment to <strong>follow me on </strong><a href="https://linkedin.com/in/sunilsandhu"><strong>LinkedIn</strong></a><strong>, </strong><a href="https://tiktok.com/@messyfounder"><strong>TikTok</strong></a>, <a href="https://instagram.com/sunilsandhu"><strong>Instagram</strong></a>. You can also subscribe to our <a href="https://newsletter.plainenglish.io/"><strong>weekly newsletter</strong></a>.</p><p>And before you go, don’t forget to <strong>clap</strong> and <strong>follow</strong> the writer️!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc68eb788582" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/zustand-no-need-to-manually-write-the-store-interface-anymore-fc68eb788582">Zustand — no need to manually write the store interface anymore!</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Make your SSR app more stable and smooth: Add error retries and data caching to your server side…]]></title>
            <link>https://suhaotian.medium.com/make-your-ssr-app-more-stable-and-smooth-add-error-retries-and-data-caching-to-your-server-side-2944cda41575?source=rss-4f6f2b75e414------2</link>
            <guid isPermaLink="false">https://medium.com/p/2944cda41575</guid>
            <category><![CDATA[server-side-rendering]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[remix]]></category>
            <category><![CDATA[nuxtjs]]></category>
            <category><![CDATA[react-router]]></category>
            <dc:creator><![CDATA[Jeremy]]></dc:creator>
            <pubDate>Fri, 21 Mar 2025 14:07:56 GMT</pubDate>
            <atom:updated>2025-03-21T14:07:56.607Z</atom:updated>
            <content:encoded><![CDATA[<h3>Make your SSR app more stable and smooth: Add error retries and data caching to your server side requests</h3><p>When building SSR applications where the backend API is separate from the frontend, we need to fetch data on the server side for Pre-rendering.</p><blockquote>We are not talking about data fetch in client side with SWR or React Query</blockquote><p>Sometimes, fetching data fails due to network issues or high traffic when many users visit the same page at once. This can lead to multiple redundant requests on the server, especially when the data is large, causing performance issues.</p><p>To improve this, we can:</p><ul><li>Retry failed requests a few times.</li><li>Deduplicate identical requests.</li><li>Cache large, non-essential, or infrequently updated data, like i18n JSON files or site configurations.</li></ul><p>These enhancements make SSR applications more stable and efficient.</p><p>Instead of patching fetch, we can use a fetch wrapper with plugin support.</p><blockquote>In Next.js, the fetch function is patched to support built-in caching.</blockquote><p>Here, we use <strong>xior.js</strong>, which I built for this purpose:</p><pre>import axios from &#39;xior&#39;;<br>import retryPlugin from &#39;xior/plugins/error-retry&#39;;<br>import cachePlugin from &#39;xior/plugins/cache&#39;;<br>import dedupeRequestPlugin from &#39;xior/plugins/dedupe&#39;;<br>import errorCachePlugin from &#39;xior/plugins/error-cache&#39;;</pre><pre>export const http = xior.create({<br>  baseURL: &#39;...&#39;,<br>});</pre><pre>http.plugins.use(dedupeRequestPlugin());<br>http.plugins.use(<br>  retryPlugin({<br>    onRetry(config, error, count) {<br>      console.log(`${config?.method} ${config?.url} retry ${count}`);<br>    },<br>  })<br>);<br>http.plugins.use(<br>  cachePlugin({<br>    cacheItems: 100,<br>    cacheTime: 1e3 * 60 * 5, // 5 minutes<br>  })<br>);<br>// http.plugins.use(errorCachePlugin()); // If a request fails and cached data exists, use the cache.</pre><p><strong>This makes data fetching more reliable and efficient in SSR applications.</strong></p><p>Hope these tips help! If you have any questions or issues, please leave a comment. More information check here <a href="https://github.com/suhaotian/xior">https://github.com/suhaotian/xior</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2944cda41575" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Replace axios and qs modules with this in frontend projects and reduce 73KB!]]></title>
            <link>https://javascript.plainenglish.io/replace-axios-and-qs-modules-with-this-in-your-frontend-projects-and-reduce-73kb-in-size-d22faf7a3456?source=rss-4f6f2b75e414------2</link>
            <guid isPermaLink="false">https://medium.com/p/d22faf7a3456</guid>
            <category><![CDATA[fetch-api]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[axios]]></category>
            <category><![CDATA[website-development]]></category>
            <dc:creator><![CDATA[Jeremy]]></dc:creator>
            <pubDate>Tue, 11 Mar 2025 04:58:37 GMT</pubDate>
            <atom:updated>2025-03-13T11:44:45.379Z</atom:updated>
            <content:encoded><![CDATA[<p>Previously, the reasons for using qs were:</p><ul><li>Encoding a nested object into a URL query string: qs.stringify({ a: { b: 1 } })</li><li>Parsing a query string into an object: qs.parse(location.search).token</li></ul><p>However, you can achieve the same functionality with lightweight alternatives:</p><ul><li>To parse a query string into an object, use the browser’s URLSearchParams :</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*ZTnorZRiAThecOp7-TQqMw.png" /><figcaption>new URLSearchParams(location.search).get(‘token’)</figcaption></figure><ul><li>To encode a nested object into a URL query string, use a lightweight implementation from <a href="https://github.com/suhaotian/xior">xior</a> :</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*680GZ2GtwEprtnE8Eci-Bg.png" /><figcaption>import { encodeParams as stringify } from ‘xior’; stringify({ a: { b: 1 } });</figcaption></figure><p>As for axios, many developers use it for its convenient API. However, with this axios-Like Fetch wrapper, you can reduce the bundle size from <strong>35.6KB to just 6KB</strong>!</p><p>axios module size:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zgFD2IqNV_uY6OkRYh6bHA.png" /><figcaption>axios bundle size screenshot</figcaption></figure><p>qs module size:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*PscIjKx9vpZshxTnNlvGRA.png" /><figcaption>qs budnle size screenshot</figcaption></figure><p><a href="https://github.com/suhaotian/xior">Xior.js</a> size:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/584/1*LlgQtLPqkuKlc29BazQAuw.png" /><figcaption>xior.js size: 6.32KB -&gt; 2.98KB(gzip)</figcaption></figure><p>The API almost same with Axios:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*h6xjGvOYwxnCIiK2coWynQ.png" /><figcaption>import axios from ‘xior’;</figcaption></figure><p>The only difference is change axios to <a href="https://github.com/suhaotian/xior">xior</a>!</p><p>So why are you still using qs and axios in your frontend projects?</p><p>If you have questions or encounter any issues, please comment or feel free to create a new issue.</p><p>Check it today 👉: <a href="https://github.com/suhaotian/xior">https://github.com/suhaotian/xior</a></p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://differ.blog/inplainenglish"><strong>Differ</strong></a></li><li><a href="https://cofeed.app/"><strong>Check out CoFeed, the smart way to stay up-to-date with the latest in tech</strong></a> <strong>🧪</strong></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d22faf7a3456" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/replace-axios-and-qs-modules-with-this-in-your-frontend-projects-and-reduce-73kb-in-size-d22faf7a3456">Replace axios and qs modules with this in frontend projects and reduce 73KB!</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>