<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>javascript on Saurabh Kumar</title><link>https://saurabh-kumar.com/tags/javascript/</link><description>Recent content in javascript on Saurabh Kumar</description><generator>Hugo</generator><language>en-US</language><copyright>Copyright © 2025, Saurabh Kumar.</copyright><lastBuildDate>Tue, 10 Feb 2026 12:00:00 +0000</lastBuildDate><atom:link href="https://saurabh-kumar.com/tags/javascript/index.xml" rel="self" type="application/rss+xml"/><item><title>Hono</title><link>https://saurabh-kumar.com/til/1770724800/</link><pubDate>Tue, 10 Feb 2026 12:00:00 +0000</pubDate><guid>https://saurabh-kumar.com/til/1770724800/</guid><description>&lt;p&gt;&lt;a href="https://hono.dev/" rel="noopener external"&gt;Hono&lt;/a&gt; based on web standards is a great option for js runtimes esp. if you plan to deploy your code to cloudflare workers, bun or deno. You get faster startup time and cross-platform compatibility.&lt;/p&gt;&#10;</description></item><item><title>npx -y npm-check-updates</title><link>https://saurabh-kumar.com/til/1766404801/</link><pubDate>Mon, 22 Dec 2025 12:00:01 +0000</pubDate><guid>https://saurabh-kumar.com/til/1766404801/</guid><description>&lt;p&gt;&lt;a href="https://github.com/raineorshine/npm-check-updates" rel="noopener external"&gt;&lt;code&gt;npx -y npm-check-updates&lt;/code&gt;&lt;/a&gt; tells you the latest versions of your &lt;code&gt;package.json&lt;/code&gt;, ignoring pinned versions.&lt;/p&gt;&#10;</description></item><item><title>React's setState is asynchronous</title><link>https://saurabh-kumar.com/til/1699444800/</link><pubDate>Wed, 08 Nov 2023 12:00:00 +0000</pubDate><guid>https://saurabh-kumar.com/til/1699444800/</guid><description>&lt;p&gt;React&amp;rsquo;s &lt;code&gt;setState&lt;/code&gt; is asynchronous: read &lt;code&gt;this.state&lt;/code&gt; right after calling it and you may get the old value. To act on the new state, pass a callback, or use &lt;code&gt;componentDidUpdate&lt;/code&gt; (which also fires on prop changes). From &lt;a href="https://daveceddia.com/react-gotchas/" rel="noopener external"&gt;React gotchas&lt;/a&gt;.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Jon&amp;#39;&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;// runs after the state update and re-render&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;});&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item></channel></rss>