<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Pritam Patil</title>
    <description>The latest articles on Forem by Pritam Patil (@pritampatil).</description>
    <link>https://forem.com/pritampatil</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F361174%2Fd7816f62-1367-4afe-8767-93fcc0ad8fbd.png</url>
      <title>Forem: Pritam Patil</title>
      <link>https://forem.com/pritampatil</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/pritampatil"/>
    <language>en</language>
    <item>
      <title>Introducing the `Temporal` Object: A Game-Changer for JavaScript Date Handling</title>
      <dc:creator>Pritam Patil</dc:creator>
      <pubDate>Thu, 12 Mar 2026 07:09:05 +0000</pubDate>
      <link>https://forem.com/pritampatil/introducing-the-temporal-object-a-game-changer-for-javascript-date-handling-3n1b</link>
      <guid>https://forem.com/pritampatil/introducing-the-temporal-object-a-game-changer-for-javascript-date-handling-3n1b</guid>
      <description>&lt;p&gt;&lt;em&gt;In the ever-evolving world of JavaScript, the &lt;code&gt;Temporal&lt;/code&gt; object is a new and exciting addition that promises to revolutionize the way we handle dates and times.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;While the &lt;code&gt;Date&lt;/code&gt; object has been a staple for many years, it has several limitations and inconsistencies that can lead to bugs and confusion. The &lt;code&gt;Temporal&lt;/code&gt; object aims to address these issues by providing a more robust and accurate way to work with temporal data.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the &lt;code&gt;Temporal&lt;/code&gt; Object?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Temporal&lt;/code&gt; object is a new JavaScript API &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal" rel="noopener noreferrer"&gt;introduced&lt;/a&gt; in the ECMAScript 2023 proposal. It is designed to offer a more precise and flexible way to work with dates and times, addressing common issues such as leap seconds, time zone differences, and calendar inconsistencies. The &lt;code&gt;Temporal&lt;/code&gt; object includes several sub-objects like &lt;code&gt;Temporal.PlainDate&lt;/code&gt;, &lt;code&gt;Temporal.PlainTime&lt;/code&gt;, and &lt;code&gt;Temporal.ZonedDateTime&lt;/code&gt;, which provide more granular control over date and time operations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Issues with Existing &lt;code&gt;Date&lt;/code&gt; Object
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Date&lt;/code&gt; object in JavaScript has been a source of frustration for developers due to its limitations and inconsistencies. Some of the key issues include:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Leap Seconds&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Date&lt;/code&gt; object does not account for leap seconds, which can lead to inaccuracies in time calculations.&lt;/li&gt;
&lt;li&gt;Leap seconds are added by certain organizations to keep Coordinated Universal Time (UTC) in sync with Earth's rotation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Time Zone Handling&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Date&lt;/code&gt; object is timezone-agnostic, meaning it doesn't natively support time zone conversions.&lt;/li&gt;
&lt;li&gt;This can lead to issues when working with dates and times across different time zones, especially during daylight saving time transitions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Calendar Inconsistencies&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Date&lt;/code&gt; object uses the Gregorian calendar, but it doesn't provide easy ways to work with other calendars like the Hijri or Chinese calendars.&lt;/li&gt;
&lt;li&gt;This can be problematic for applications that need to handle dates in non-Gregorian calendars.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Complexity in Operations&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Operations like date arithmetic, comparing dates, and formatting can be complex and error-prone with the &lt;code&gt;Date&lt;/code&gt; object.&lt;/li&gt;
&lt;li&gt;This complexity can lead to bugs and inconsistencies in date-related logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Lack of Granularity&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Date&lt;/code&gt; object represents a point in time as a floating-point number, which can lose precision for very long periods.&lt;/li&gt;
&lt;li&gt;This can be problematic for applications that require high-precision date and time calculations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Does the &lt;code&gt;Temporal&lt;/code&gt; Object Solve?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Temporal&lt;/code&gt; object addresses these issues by providing a more precise and flexible way to handle dates and times. Here are some of the key benefits:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Leap Second Support&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Temporal&lt;/code&gt; object accounts for leap seconds, ensuring accurate time calculations.&lt;/li&gt;
&lt;li&gt;This is particularly important for applications that need to maintain precise time synchronization.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Time Zone Support&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Temporal&lt;/code&gt; object includes support for time zones and can handle daylight saving time transitions.&lt;/li&gt;
&lt;li&gt;This makes it easier to work with dates and times across different regions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Calendar Flexibility&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Temporal&lt;/code&gt; object allows working with different calendars, providing a more comprehensive solution for applications that need to handle non-Gregorian calendars.&lt;/li&gt;
&lt;li&gt;This flexibility can be crucial for applications serving diverse user bases or historical data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Simplified Date Arithmetic&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Temporal&lt;/code&gt; object provides a simpler and more reliable way to perform date arithmetic, such as adding or subtracting time periods.&lt;/li&gt;
&lt;li&gt;This can reduce the complexity and potential for bugs in date-related logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;High Precision&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;Temporal&lt;/code&gt; object provides higher precision for date and time calculations, ensuring accuracy for long periods.&lt;/li&gt;
&lt;li&gt;This is particularly useful for applications that require precise date and time tracking.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Migrating to the &lt;code&gt;Temporal&lt;/code&gt; Object
&lt;/h2&gt;

&lt;p&gt;While the &lt;code&gt;Temporal&lt;/code&gt; object is still in the proposal stage, it's important to start planning a migration strategy. Here are some steps you can take to prepare:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Evaluate Your Needs&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Determine whether your application would benefit from the &lt;code&gt;Temporal&lt;/code&gt; object's features.&lt;/li&gt;
&lt;li&gt;Assess the current usage of the &lt;code&gt;Date&lt;/code&gt; object in your codebase and identify areas that could be improved.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Use Polyfills and Libraries&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;While the &lt;code&gt;Temporal&lt;/code&gt; object is not yet part of the standard, you can use &lt;a href="https://www.npmjs.com/package/@js-temporal/polyfill" rel="noopener noreferrer"&gt;polyfills&lt;/a&gt; or libraries like &lt;code&gt;temporal.js&lt;/code&gt; to start working with the &lt;code&gt;Temporal&lt;/code&gt; API today.&lt;/li&gt;
&lt;li&gt;These tools can help you start integrating the &lt;code&gt;Temporal&lt;/code&gt; object into your codebase without waiting for full browser support.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Refactor Your Code&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Identify and refactor parts of your code that could benefit from the &lt;code&gt;Temporal&lt;/code&gt; object.&lt;/li&gt;
&lt;li&gt;Start by converting simple date operations and gradually move to more complex date handling.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Test Thoroughly&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Write extensive tests to ensure that your refactored code works as expected.&lt;/li&gt;
&lt;li&gt;Use test cases that cover edge cases and potential bugs to catch any issues early.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Monitor Browser Support&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Keep an eye on browser support for the &lt;code&gt;Temporal&lt;/code&gt; object.&lt;/li&gt;
&lt;li&gt;Use tools like &lt;a href="https://caniuse.com/?search=temporal" rel="noopener noreferrer"&gt;Can I Use&lt;/a&gt; to monitor when full support is available.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  6. &lt;strong&gt;Document Your Changes&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Document the changes you make to your codebase, including the reasons for the refactoring and any potential issues.&lt;/li&gt;
&lt;li&gt;This documentation will be valuable for future maintenance and for other developers working on the project.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Temporal&lt;/code&gt; object is a significant step forward in JavaScript's date and time handling capabilities. While it is still in the proposal stage, its potential benefits make it&lt;br&gt;
worth considering for applications that require high precision and accuracy in date and time calculations. &lt;br&gt;
By planning a strategic migration, you can take advantage of these new features and improve the reliability and performance of your applications.&lt;/p&gt;

&lt;p&gt;Stay tuned for updates on the &lt;code&gt;Temporal&lt;/code&gt; object and its integration into the JavaScript standard. Happy coding!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>browser</category>
      <category>frontend</category>
    </item>
    <item>
      <title>React 2026: Why the All-Client SPA Is Becoming Legacy Code</title>
      <dc:creator>Pritam Patil</dc:creator>
      <pubDate>Tue, 20 Jan 2026 04:03:27 +0000</pubDate>
      <link>https://forem.com/pritampatil/react-2026-why-the-all-client-spa-is-becoming-legacy-code-3d8e</link>
      <guid>https://forem.com/pritampatil/react-2026-why-the-all-client-spa-is-becoming-legacy-code-3d8e</guid>
      <description>&lt;p&gt;&lt;em&gt;If you’re still building React apps that ship everything to the client, you’re building for 2019, not 2029.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let me explain why the single-page application (SPA) as we know it is entering its legacy phase — and what’s replacing it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The SPA Trade-Off That’s No Longer Worth It
&lt;/h2&gt;

&lt;p&gt;For years, we accepted a fundamental trade-off:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Rich interactivity came at the cost of JavaScript bloat.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We shipped entire frameworks to the browser so users could click between routes without full page reloads. We accepted:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;100-500KB JavaScript bundles before our actual code&lt;/li&gt;
&lt;li&gt;Client-side data fetching waterfalls&lt;/li&gt;
&lt;li&gt;The dreaded loading-spinner-everywhere experience&lt;/li&gt;
&lt;li&gt;Hydration overhead that blocked interactivity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This made sense when the alternative was jQuery spaghetti or full server roundtrips. But in 2026, we have a better option.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Hybrid Architecture: Server Components + Client Components
&lt;/h2&gt;

&lt;p&gt;React Server Components (RSCs) aren’t just another feature—they’re a fundamental architectural shift. Here’s the new mental model:&lt;/p&gt;

&lt;h3&gt;
  
  
  Server Components: The Foundation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Run once on the server during render&lt;/li&gt;
&lt;li&gt;Can directly access databases, APIs, filesystems&lt;/li&gt;
&lt;li&gt;Zero JavaScript shipped to the client&lt;/li&gt;
&lt;li&gt;Perfect for: data fetching, static content, layouts, non-interactive UI
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// This component NEVER ships to the browser&lt;/span&gt;
&lt;span class="c1"&gt;// It runs safely on your server, fetching fresh data each request&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ProductDetails&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;productId&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;product&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;products&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findUnique&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; 
    &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;productId&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; 
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;description&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Price is static content - stays on server */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;PriceDisplay&lt;/span&gt; &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* AddToCartButton IS interactive - becomes client component */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;AddToCartButton&lt;/span&gt; &lt;span class="na"&gt;productId&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Client Components: The Interactive Islands
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Marked with &lt;code&gt;use client&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Handle user interactions, state, effects&lt;/li&gt;
&lt;li&gt;Only shipped where needed&lt;/li&gt;
&lt;li&gt;Perfect for: forms, buttons, animations, real-time updates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The key insight? &lt;strong&gt;Most of your app isn't interactive.&lt;/strong&gt;&lt;br&gt;
Your navigation, footer, hero section, product descriptions, blog content—these don't need React state or effects. They just need to render.&lt;/p&gt;
&lt;h3&gt;
  
  
  The 2026 Stack: A Concrete Example
&lt;/h3&gt;

&lt;p&gt;Let's walk through what a modern e-commerce page looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 2024 Approach (SPA)&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ProductPage&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setProduct&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;reviews&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setReviews&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;([]);&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Two client-side fetches = double latency&lt;/span&gt;
    &lt;span class="nf"&gt;fetchProduct&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;setProduct&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nf"&gt;fetchReviews&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;setReviews&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Spinner&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ProductDetails&lt;/span&gt; &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Has price, description */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ReviewsList&lt;/span&gt; &lt;span class="na"&gt;reviews&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;reviews&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;    &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Static content */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;AddToCart&lt;/span&gt; &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Interactive */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;RelatedProducts&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;                  &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* More fetches... */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// Bundle: ~150KB React + 50KB app code = 200KB to customer&lt;/span&gt;

&lt;span class="c1"&gt;// 2026 Approach (Hybrid)&lt;/span&gt;
&lt;span class="c1"&gt;// Server Component (runs on server, zero JS to browser)&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ProductPage&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;productId&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reviews&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;related&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;all&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;products&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findUnique&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;productId&lt;/span&gt; &lt;span class="p"&gt;}}),&lt;/span&gt;
    &lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;reviews&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findMany&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;productId&lt;/span&gt; &lt;span class="p"&gt;}}),&lt;/span&gt;
    &lt;span class="nf"&gt;getRelatedProducts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;productId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;]);&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Static content rendered to HTML on server */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ProductDetails&lt;/span&gt; &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ReviewsList&lt;/span&gt; &lt;span class="na"&gt;reviews&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;reviews&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* Only these interactive bits become client JS */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;AddToCart&lt;/span&gt; &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* ~3KB */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ProductRecommendations&lt;/span&gt; &lt;span class="na"&gt;products&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;related&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt; &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* ~5KB */&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// Bundle: ~8KB of interactive JS only&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Impact&lt;/strong&gt;: The user sees content immediately. JavaScript loads in the background for the "Add to Cart" button. No spinners. No hydration blocking.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why This Is Inevitable
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Performance Expectations Have Changed
&lt;/h4&gt;

&lt;p&gt;Users expect pages to load in &amp;lt; 2 seconds on mobile. Core Web Vitals are now Google ranking factors. The 200KB SPA can't compete with 8KB of progressive hydration.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. The Economics Make Sense
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Bandwidth costs drop when you ship less JavaScript&lt;/li&gt;
&lt;li&gt;CPU usage drops when you don't hydrate entire trees&lt;/li&gt;
&lt;li&gt;Developer time drops when you don't manage client-side data fetching&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. The Frameworks Are All Moving This Way
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Next.js App Router (RSC-first)&lt;/li&gt;
&lt;li&gt;Remix with React 19&lt;/li&gt;
&lt;li&gt;Gatsby moving to partial hydration&lt;/li&gt;
&lt;li&gt;Astro proving islands architecture works at scale&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When every major framework converges on an architecture, it's not a trend—it's the future.&lt;/p&gt;

&lt;h3&gt;
  
  
  What "Legacy" Means in Practice
&lt;/h3&gt;

&lt;p&gt;Your existing SPA isn't suddenly obsolete tomorrow. But "legacy" in 2026 means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;New features&lt;/strong&gt; are built with hybrid architecture&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance-critical pages&lt;/strong&gt; get incremental migration&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;New hires&lt;/strong&gt; learn RSC patterns first&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tooling and libraries&lt;/strong&gt; prioritize RSC compatibility&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's the same transition we saw with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Class components → Hooks (2019)&lt;/li&gt;
&lt;li&gt;REST → GraphQL (2017)&lt;/li&gt;
&lt;li&gt;jQuery → React (2015)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The old way still works, but the momentum has shifted.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Skills That Will Matter in 2026
&lt;/h3&gt;

&lt;p&gt;As we transition, these skills become valuable:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Architecture Design
Knowing what should be server vs client
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Good 2026 thinking:&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This product grid needs sorting? Client component.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This blog post content? Server component.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This header with search? Split: static HTML + client search logic.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Data Flow Understanding
Server Components pass data to Client Components via serializable props
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Server Component&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ClientComponent&lt;/span&gt; 
  &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;product&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;  &lt;span class="c1"&gt;// ✅ Serializable&lt;/span&gt;
  &lt;span class="na"&gt;onAction&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;handleAction&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;  &lt;span class="c1"&gt;// ❌ Functions won't work&lt;/span&gt;
&lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Performance Optimization&lt;br&gt;
Not just "make it fast," but "ship less, compute server-side, hydrate minimally"&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security Awareness&lt;br&gt;
Understanding what code runs where, and keeping secrets on the server&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Migration Path: Start Today
&lt;/h3&gt;

&lt;p&gt;You don't need to rewrite your app. Start with the 80/20 rule:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Identify non-interactive pages&lt;/strong&gt; (About, Blog, Documentation)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Convert them&lt;/strong&gt; to Server Components&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extract interactive pieces&lt;/strong&gt; as Client Components&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Measure the bundle reduction&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A typical migration yields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;40-70% JavaScript reduction&lt;/li&gt;
&lt;li&gt;30-50% faster Largest Contentful Paint&lt;/li&gt;
&lt;li&gt;Simpler data fetching code&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Counterarguments (And Why They're Fading)
&lt;/h3&gt;

&lt;p&gt;"But we need SSR for SEO!"&lt;br&gt;
Server Components give you SSR automatically, plus zero-client-JS for static parts.&lt;/p&gt;

&lt;p&gt;"Our users need full offline support!"&lt;br&gt;
Service Workers + Client Components for critical paths still work. Most apps don't need full offline.&lt;/p&gt;

&lt;p&gt;"This locks us into a framework!"&lt;br&gt;
True, but you were already locked into React. The framework just provides the server runtime.&lt;/p&gt;

&lt;h2&gt;
  
  
  Looking Ahead: What Comes After Hybrid?
&lt;/h2&gt;

&lt;p&gt;If hybrid architecture is 2026, what's 2028?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;AI-generated component splits&lt;/strong&gt;&lt;br&gt;
Tools that automatically optimize server/client boundaries&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Predictive prefetching&lt;/strong&gt;&lt;br&gt;
Server Components that know what you'll click next&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Edge Components&lt;/strong&gt;&lt;br&gt;
Running React Components on CDNs for 10ms global latency&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WebAssembly&lt;/strong&gt; integration&lt;br&gt;
Heavy computations running safely on client via WASM, not JavaScript&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Conclusion: The Writing Is on the Bundle
&lt;/h3&gt;

&lt;p&gt;The metrics don't lie:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Airbnb reduced JavaScript by 40% with RSCs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Vercel's dashboard saw 60% faster interactions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Developers report simpler data fetching code&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The all-client SPA served us well for a decade. But in technology, a decade is an eternity.&lt;/p&gt;

&lt;p&gt;The future isn't "less JavaScript"—it's &lt;strong&gt;smarter JavaScript&lt;/strong&gt;. Shipping only what's needed, when it's needed, to whom it's needed.&lt;/p&gt;

&lt;p&gt;Your next project shouldn't be a SPA. It should be a &lt;strong&gt;strategically split application&lt;/strong&gt; that respects both your users' bandwidth and your developers' sanity.&lt;/p&gt;

&lt;p&gt;The transition has already started. The question isn't whether you'll adopt hybrid architecture, but &lt;strong&gt;how gracefully you'll make the shift&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;Are you building with Server Components yet? What's been your biggest challenge or insight? Share in the comments—I read every one.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>javascript</category>
      <category>performance</category>
      <category>react</category>
    </item>
    <item>
      <title>12 CSS Best Practices by Twitter</title>
      <dc:creator>Pritam Patil</dc:creator>
      <pubDate>Sun, 20 Jun 2021 18:31:15 +0000</pubDate>
      <link>https://forem.com/pritampatil/12-css-best-practices-by-twitter-2fap</link>
      <guid>https://forem.com/pritampatil/12-css-best-practices-by-twitter-2fap</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;p&gt;When grouping selectors, keep individual selectors to a single line.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F996efsjnuinntlqk6ijv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F996efsjnuinntlqk6ijv.png" alt="single-line-selectors"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don't prefix property values with a leading zero.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffsjbjp9hf636m5yzfif9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffsjbjp9hf636m5yzfif9.png" alt="leading-zero-prefix"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Lowercase all hex values and use shorthand hex values whenever possible.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fry3gqaxgwnnuw74dbol0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fry3gqaxgwnnuw74dbol0.png" alt="shorthand-hex"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid specifying units for zero values.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98z2xi6ajgs3z9ooxfub.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F98z2xi6ajgs3z9ooxfub.png" alt="no-units-zero"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Related property declarations should be grouped together following the order: &lt;em&gt;position, box-model, typography, visual. misc.&lt;/em&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawrhul1os9x6v7qq1fpj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fawrhul1os9x6v7qq1fpj.png" alt="declaration-order"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Don't use &lt;code&gt;!important&lt;/code&gt; - It is a last resort generally and  only use when you need to override something and there is no other way. Instead increase the specificity of the selector.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fibo1zf31l617fpu72m0f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fibo1zf31l617fpu72m0f.png" alt="no-imp-use-specificity"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;When a rule set includes only one declaration, consider removing line breaks for readability and faster editing.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmyk5yh1n7mabhatxvev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhmyk5yh1n7mabhatxvev.png" alt="single-declare-no-line-break"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Limit shorthand declaration usage to instances where you must explicitly set all available values.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fryiyros8hk3vocivr6j7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fryiyros8hk3vocivr6j7.png" alt="shorthand-declare-limit"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ensure your code is descriptive, well commented and approachable by others. Great code comments convey context and/or purpose.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdnswmuygpvpr89envl93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdnswmuygpvpr89envl93.png" alt="good-comments"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Class names:&lt;br&gt;
a. Keep them lowercase and use dashes to separate words&lt;br&gt;
b. Avoid excessive shorthand notation. (&lt;code&gt;.btn&lt;/code&gt; is fine, &lt;code&gt;.s&lt;/code&gt; is not)&lt;br&gt;
c. Use meaningful names: use structural or purposeful names over presentation.&lt;br&gt;
d. Prefix classes based on the closest parent or base class.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbutixqdqp3c6xolzmcw2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbutixqdqp3c6xolzmcw2.png" alt="classname-rules"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Selectors:&lt;br&gt;
a. Use classes over generic element tag for optimum rendering performance.&lt;br&gt;
b. Avoid using several attribute selectors (e.g. &lt;code&gt;[class^="..."]&lt;/code&gt;) on commonly occurring components. &lt;em&gt;Browser performance is known to be impacted by these&lt;/em&gt;.&lt;br&gt;
c. Keep selectors short and strive to limit the number of elements in each selector to three names over presentational.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh5sgk0fl2r6lk3qp1wyp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh5sgk0fl2r6lk3qp1wyp.png" alt="selector-rules"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Place media queries as close to their relevant rule sets whenever possible.&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp576rlqnzhpki61kma98.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp576rlqnzhpki61kma98.png" alt="media-query-rule"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://twitter.com/TheDoucheP" rel="noopener noreferrer"&gt;twitter&lt;/a&gt; or &lt;a href="https://github.com/pritam-patil" rel="noopener noreferrer"&gt;Github&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to test your UI without resizing browser</title>
      <dc:creator>Pritam Patil</dc:creator>
      <pubDate>Wed, 16 Jun 2021 15:00:01 +0000</pubDate>
      <link>https://forem.com/pritampatil/how-to-test-your-ui-without-resizing-browser-18g2</link>
      <guid>https://forem.com/pritampatil/how-to-test-your-ui-without-resizing-browser-18g2</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;When working on UI layouts, for testing responsiveness - you may be used to either:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;DevTools with custom viewport sizes&lt;/li&gt;
&lt;li&gt;Or some extension e.g. Window Resizer&lt;/li&gt;
&lt;li&gt;Or resize the browser window itself&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The problem with above approaches is you would be testing with fixed window sizes.&lt;/p&gt;

&lt;h2&gt;
  
  
  The solution
&lt;/h2&gt;

&lt;p&gt;Enter css property &lt;code&gt;resize&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The property accepts 4 different values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;both&lt;/em&gt; - resized both &lt;em&gt;horizontally&lt;/em&gt; and &lt;em&gt;vertically&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;horizontal&lt;/em&gt; - resize it in the &lt;em&gt;horizontal&lt;/em&gt; direction&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;vertical - resize it in the *vertical&lt;/em&gt; direction&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;none&lt;/em&gt; - &lt;strong&gt;no&lt;/strong&gt; user-controllable method for resizing it.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;The rules to use &lt;code&gt;resize&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;NO inline elements&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;overflow&lt;/code&gt; is NOT &lt;code&gt;visible&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;Say you have code that has items wrapped in a flex container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;  &lt;span class="nt"&gt;&amp;lt;ul&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"items"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt; item &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt; lorem ipsum dorem &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt; Lorem ipsum dolor sit amet &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt; consectetur adipiscing elit, sed do eiusmod tempor incididun &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.items&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;flex-flow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="n"&gt;wrap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;space-evenly&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;li&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To use &lt;code&gt;resize&lt;/code&gt;, you'll wrap the &lt;code&gt;ul&lt;/code&gt; with style as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;both&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt; item &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt; lorem ipsum dorem &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt; Lorem ipsum dolor sit amet &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt; consectetur adipiscing elit, sed do eiusmod tempor incididun &lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this, you can test the responsiveness easily:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdu8qruc0s9mj6gtev17a.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdu8qruc0s9mj6gtev17a.gif" alt="Responsive test"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Codepen for a demo is available &lt;a href="https://codepen.io/pritam-patil/pen/poeGRva" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;...&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://twitter.com/TheDoucheP" rel="noopener noreferrer"&gt;twitter&lt;/a&gt; or &lt;a href="https://github.com/pritam-patil" rel="noopener noreferrer"&gt;Github&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>css</category>
      <category>responsiveness</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
