<?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>DEV Community: Sarvesh Patil</title>
    <description>The latest articles on DEV Community by Sarvesh Patil (@sarveshh).</description>
    <link>https://dev.to/sarveshh</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%2F482324%2Fcc7dd5e7-23e7-4c9c-b787-59f03c20b2cb.png</url>
      <title>DEV Community: Sarvesh Patil</title>
      <link>https://dev.to/sarveshh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sarveshh"/>
    <language>en</language>
    <item>
      <title>Microfrontends with React: A Complete Guide from Basics to Advanced</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Tue, 16 Dec 2025 05:55:09 +0000</pubDate>
      <link>https://dev.to/sarveshh/microfrontends-with-react-a-complete-guide-from-basics-to-advanced-31m5</link>
      <guid>https://dev.to/sarveshh/microfrontends-with-react-a-complete-guide-from-basics-to-advanced-31m5</guid>
      <description>&lt;h1&gt;
  
  
  Microfrontends with React: What I Learned (and Why I Almost Ditched It)
&lt;/h1&gt;

&lt;p&gt;I'm gonna be real with you - when I first heard about microfrontends, it sounded like the solution to literally everything. Independent teams! Deploy without fear! Different frameworks per module!&lt;/p&gt;

&lt;p&gt;Spoiler: it's not magic. It's actually pretty complicated. But when it works, it's really good.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's a Microfrontend Anyway?
&lt;/h2&gt;

&lt;p&gt;Think of it like this - instead of one massive React app that everyone commits to, you're splitting it into smaller React apps that live separately and talk to each other.&lt;/p&gt;

&lt;p&gt;The classic example: you have a header component built by the platform team, a product listing built by the commerce team, and a cart built by the checkout team. All deployed independently. All running at the same time on the same page.&lt;/p&gt;

&lt;p&gt;That's a microfrontend setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I Started Using Them (The Real Reasons)
&lt;/h2&gt;

&lt;p&gt;I was working on this e-commerce platform with like 5 different teams, and our main app became a nightmare. 200KB bundle just for vendor dashboard stuff that 90% of users never saw. A change to the header meant rebuilding everything. Deploy conflicts happened every day.&lt;/p&gt;

&lt;p&gt;Microfrontends seemed like "okay, each team owns their domain, they ship code independently, no more conflicts."&lt;/p&gt;

&lt;p&gt;That part actually works. When you set it up right.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Module Federation Actually Works
&lt;/h2&gt;

&lt;p&gt;Webpack 5 gave us this thing called Module Federation. It's basically a way to load code from different domains/ports at runtime instead of bundling everything upfront.&lt;/p&gt;

&lt;p&gt;Here's what I did:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Header app (runs on localhost:3001)&lt;/span&gt;
&lt;span class="c1"&gt;// webpack.config.js&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;ModuleFederationPlugin&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;webpack&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;production&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/index&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;__dirname&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/dist&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;[name].[contenthash].js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;devServer&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3001&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Access-Control-Allow-Origin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;*&lt;/span&gt;&lt;span class="dl"&gt;"&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="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ModuleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;remoteEntry.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;exposes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./Header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/Header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;shared&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;react&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;singleton&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;requiredVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;^18.0.0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-dom&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;singleton&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;requiredVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;^18.0.0&lt;/span&gt;&lt;span class="dl"&gt;"&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="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;The important bits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;name&lt;/strong&gt;: tells other apps "I'm the header app"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;exposes&lt;/strong&gt;: "I'm sharing this component"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;shared with singleton&lt;/strong&gt;: "use MY version of React if you don't have one, don't load React twice"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then the main app says "I want header":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Main shell app (localhost:3000)&lt;/span&gt;
&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ModuleFederationPlugin&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mainApp&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;remotes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;header&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;header@http://localhost:3001/remoteEntry.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;shared&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;react&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;singleton&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;requiredVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;^18.0.0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-dom&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;singleton&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;requiredVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;^18.0.0&lt;/span&gt;&lt;span class="dl"&gt;"&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then you import it like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;lazy&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Suspense&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&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;Header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;lazy&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;header/Header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Suspense&lt;/span&gt; &lt;span class="nx"&gt;fallback&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;loading&lt;/span&gt; &lt;span class="nx"&gt;header&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;}&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Header&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Suspense&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;main&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* rest of app */&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/main&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&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;p&gt;This works surprisingly well. The header app loads independently, React only loads once, everything plays nice.&lt;/p&gt;

&lt;h2&gt;
  
  
  State Management: The Part That Bit Me
&lt;/h2&gt;

&lt;p&gt;Here's where I messed up initially. I thought "oh I can just use Context API across modules!"&lt;/p&gt;

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

&lt;p&gt;Context only works within a single React tree. When you lazy-load a component from a different webpack bundle, it's technically a different React root. Your context provider is in shell, but the remote module has its own React instance.&lt;/p&gt;

&lt;p&gt;I burned like 3 days figuring that out.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What actually works:&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 1: URL + localStorage (Simple approach)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// When user logs in in the auth module&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&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="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;location&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`#user-logged-in`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// In other modules, listen to storage events&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handleStorageChange&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&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;newUser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;newValue&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nf"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;newUser&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="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;storage&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handleStorageChange&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;storage&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handleStorageChange&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Honestly? This works for simple stuff. User logged in, user preferences, basic state. Not great for complex state.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 2: Window Events (Better)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Auth module emits an event&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleLogin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&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;event&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;CustomEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;app:user-login&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;detail&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dispatchEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Header module listens&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleUserLogin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;detail&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;app:user-login&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handleUserLogin&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;app:user-login&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handleUserLogin&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is better. Each module is independent, they communicate via events. If one crashes, others don't care.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 3: Shared State Service (What We Do Now)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// shared-state-service.js - tiny module both import&lt;/span&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;StateService&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listeners&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Map&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;user&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="na"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;light&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;cart&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="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;callback&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listeners&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listeners&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&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;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listeners&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// unsubscribe&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cbs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listeners&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="nx"&gt;cbs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;splice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;cbs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;callback&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="mi"&gt;1&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="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;value&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listeners&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;listeners&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;cb&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;cb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="nf"&gt;getState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&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="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;key&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;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;StateService&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in your modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Auth module&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;stateService&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;shared/state-service&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleLogin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;stateService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Header module&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;stateService&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;shared/state-service&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Header&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;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setUser&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="nx"&gt;stateService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&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="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;stateService&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setUser&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;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/header&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is what we use now. Tiny, works reliably, each module stays independent.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Stuff Nobody Talks About
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Version Conflicts Are Real
&lt;/h3&gt;

&lt;p&gt;You'll have situations where module A needs lodash@4 but module B needs &lt;a href="mailto:lodash@3"&gt;lodash@3&lt;/a&gt;. They're in &lt;code&gt;shared&lt;/code&gt;, now you've got both in production. Your bundle suddenly jumped 200KB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we do:&lt;/strong&gt; Lock versions at the shell level. All remotes MUST use the versions we specify.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Error Handling Is Painful
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Header&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;lazy&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;header/Header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;err&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="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;header load failed&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// Return fallback component&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Header&lt;/span&gt; &lt;span class="nx"&gt;unavailable&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt; }&lt;/span&gt;&lt;span class="err"&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;p&gt;If the header app is down in production, your entire page doesn't break. But you need to handle this explicitly.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Local Development Gets Messy
&lt;/h3&gt;

&lt;p&gt;Running header on 3001, sidebar on 3002, main app on 3000? You need a script that starts all three. DevTools become confusing. Debugging is annoying because code's spread across tabs.&lt;/p&gt;

&lt;p&gt;We use docker-compose for local dev now.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Microfrontends Actually Make Sense
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multiple independent teams&lt;/strong&gt; that deploy on different schedules&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Large apps&lt;/strong&gt; where different domains truly don't talk to each other much&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Different performance requirements&lt;/strong&gt; (cart is performance-critical, admin dashboard isn't)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  When They're Overkill
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Small team, single app&lt;/li&gt;
&lt;li&gt;Heavy cross-domain state sharing&lt;/li&gt;
&lt;li&gt;When you actually LIKE your monolith&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Honestly? We use it now because we have to, and it works. But if I could go back, I'd probably keep the main app as a monolith and only use microfrontends for truly independent features (like admin dashboard as a separate app).&lt;/p&gt;

&lt;h2&gt;
  
  
  Real Gotchas I Hit
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;CSS collisions&lt;/strong&gt; - module A sets &lt;code&gt;body { font-size: 16px }&lt;/code&gt;, module B expects &lt;code&gt;18px&lt;/code&gt;. Use CSS modules or shadow DOM&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bundle duplication&lt;/strong&gt; - forgot to mark React as shared, loaded it 3 times. Page was 500KB instead of 200KB&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CORS issues&lt;/strong&gt; - remoteEntry.js wasn't being served with right headers, everything failed silently&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State out of sync&lt;/strong&gt; - one module cached user data, other got new data, confusion everywhere&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What I'd Do Differently
&lt;/h2&gt;

&lt;p&gt;If I were starting over, I'd:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Keep it monolithic until you genuinely need microfrontends&lt;/li&gt;
&lt;li&gt;Start with just 2-3 remotes, not 10&lt;/li&gt;
&lt;li&gt;Have a shared library for state service from day one&lt;/li&gt;
&lt;li&gt;Use feature flags to gradually roll out each module&lt;/li&gt;
&lt;li&gt;Have ONE person own the shell/orchestration code&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Resources That Actually Helped
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Module Federation docs are decent&lt;/li&gt;
&lt;li&gt;Zack Jackson's talks are gold&lt;/li&gt;
&lt;li&gt;Honestly, your own code is the best teacher&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Microfrontends aren't the future for everyone. They're a tool that solves specific problems really well. Just don't use them because they sound cool.&lt;/p&gt;

&lt;p&gt;Learned that the hard way.&lt;/p&gt;

</description>
      <category>react</category>
      <category>frontend</category>
      <category>architecture</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The Definitive Guide to Updating Node.js Dependencies in 2025 (Without Losing Your Mind)</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Sun, 14 Dec 2025 09:13:20 +0000</pubDate>
      <link>https://dev.to/sarveshh/updating-node-dependencies-the-2025-survival-guide-1ge4</link>
      <guid>https://dev.to/sarveshh/updating-node-dependencies-the-2025-survival-guide-1ge4</guid>
      <description>&lt;p&gt;Long story short: You are entering a world of pain.&lt;/p&gt;

&lt;p&gt;If you've just opened a repo that hasn't been touched in six months and decided to "quickly update packages," you know exactly what I'm talking about. It starts with good intentions and ends with you questioning your career choices at 2 AM.&lt;/p&gt;

&lt;p&gt;But ignoring it isn't a strategy—it's just technical debt compounding daily.&lt;/p&gt;

&lt;p&gt;Here is the no-nonsense workflow to getting your green checkmarks back without blowing up production.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 1: Know Your Enemy
&lt;/h2&gt;

&lt;p&gt;Before you touch the terminal, you need to understand why things break.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SemVer (Semantic Versioning)&lt;/strong&gt;: It's a trust exercise.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Patch/Minor (Green/Yellow)&lt;/strong&gt;: Should be backwards compatible. Usually safe.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Major (Red)&lt;/strong&gt;: The author definitely broke something on purpose. Proceed with caution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Node Version Drift&lt;/strong&gt;: If you are still running Node 16 (or older), stop. You are running on unmaintained software. Most modern libraries now require Node 20 or 22 minimum.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The "Ghost" Package&lt;/strong&gt;: Sometimes a package is just... gone. The maintainer quit. You might have to rip it out entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 2: The Setup
&lt;/h2&gt;

&lt;p&gt;Do not start upgrading without these two safety nets.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Engine Locking
&lt;/h3&gt;

&lt;p&gt;Stop your coworkers (or your future self) from trying to run your Node 22 project on Node 14. Add this to your &lt;code&gt;package.json&lt;/code&gt; immediately:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"engines"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;gt;=20.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"pnpm"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&amp;gt;=9.0.0"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. The "Sanity Check"
&lt;/h3&gt;

&lt;p&gt;If you don't have automated tests, you are gambling. Pure and simple. If you have zero tests, write at least one "smoke test" that checks if the app actually boots up before you start messing with dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 3: The Tools (Stop doing it manually)
&lt;/h2&gt;

&lt;p&gt;If you are manually changing version numbers in &lt;code&gt;package.json&lt;/code&gt;, you are wasting your time. We have interactive tools for this now.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you use pnpm (Standard for 2025)&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pnpm update -i
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;If you use Yarn&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn upgrade-interactive
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;If you use npm&lt;/strong&gt;: The native npm experience is still lacking here. Grab &lt;code&gt;npm-check-updates&lt;/code&gt; (ncu).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx npm-check-updates -i
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Phase 4: The Strategy
&lt;/h2&gt;

&lt;p&gt;When you run those commands, you'll get a list of packages color-coded by how scary the update is.&lt;/p&gt;

&lt;p&gt;Here is the playbook:&lt;/p&gt;

&lt;h3&gt;
  
  
  The "Easy Win" Sweep
&lt;/h3&gt;

&lt;p&gt;Select all the Green and Yellow updates (patch/minor). Hit update. Run your tests. Commit this separately with a message like &lt;code&gt;chore: update non-breaking dependencies&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Red Zone (Major Updates)
&lt;/h3&gt;

&lt;p&gt;This is where the actual work is.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rule #1&lt;/strong&gt;: One at a time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rule #2&lt;/strong&gt;: Read the Changelog. Go to the GitHub releases page and Ctrl+F for "Breaking Changes."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rule #3&lt;/strong&gt;: Verify. Fix the code, run the app, ensure it works.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you try to update 5 major versions at once, you will create a dependency conflict so deep you'll want to delete the repo. Don't be a hero.&lt;/p&gt;

&lt;h3&gt;
  
  
  Decision Flow
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fozralu9ekwxdouks4lqs.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fozralu9ekwxdouks4lqs.webp" alt="Decision Flow" width="800" height="1954"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Phase 5: The "Boss Battles"
&lt;/h2&gt;

&lt;p&gt;There are two scenarios that will make you want to quit.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Updating Node.js itself
&lt;/h3&gt;

&lt;p&gt;Moving from Node 18 to 22 isn't just a number change. It often breaks binary dependencies (like image processors or encryption tools).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix&lt;/strong&gt;: Usually, you need to nuke your &lt;code&gt;node_modules&lt;/code&gt; and lockfile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rm -rf node_modules pnpm-lock.yaml
pnpm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. The Deprecated Package
&lt;/h3&gt;

&lt;p&gt;You see a warning: "This package is deprecated."&lt;/p&gt;

&lt;p&gt;This isn't an update task; it's a rewrite. If a library is dead, you have to find an alternative. Do not squeeze this into your maintenance PR. Create a separate ticket for "Replace [Dead Library]" and do it later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pro Tip: Automate the misery
&lt;/h2&gt;

&lt;p&gt;Honestly, doing this manually is labor. I feel like I should get paid double every time I resolve a peer dependency conflict.&lt;/p&gt;

&lt;p&gt;In 2025, just set up &lt;strong&gt;Renovate Bot&lt;/strong&gt; or &lt;strong&gt;GitHub's Dependabot&lt;/strong&gt;. Configure it to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatically merge patch updates (if tests pass)&lt;/li&gt;
&lt;li&gt;Open PRs for major updates so you can review them one by one&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Take it slow. If you have a massive backlog, don't do it all in one Friday afternoon. Chip away at it.&lt;/p&gt;

&lt;p&gt;And if you see a red error message... well, welcome to the club.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>JavaScript Object Functions Cheat Sheet: Your Ultimate Guide</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Sun, 19 Mar 2023 06:08:51 +0000</pubDate>
      <link>https://dev.to/sarveshh/javascript-object-functions-cheat-sheet-your-ultimate-guide-27el</link>
      <guid>https://dev.to/sarveshh/javascript-object-functions-cheat-sheet-your-ultimate-guide-27el</guid>
      <description>&lt;h3&gt;
  
  
  Preparing for an interview or just refreshing your Object manipulation skills? This is all you’ll need.
&lt;/h3&gt;




&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;JavaScript is a versatile programming language that provides developers with a range of powerful tools to work with. One such tool is an Object.&lt;/p&gt;

&lt;p&gt;With this cheat sheet, you’ll be able to quickly and easily reference the most important object functions in JavaScript. Let’s dive straight into it then.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;What is an Object&lt;/strong&gt;?&lt;br&gt;
Objects are essential for creating complex data structures and organizing code in Javascript and are the building blocks of any JavaScript program. They allow developers to perform various operations on objects, including adding or removing properties, looping through object properties, and checking for the existence of properties.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;What are enumerables in Javascript?&lt;/strong&gt;&lt;br&gt;
In JavaScript, enumerable is a property attribute that determines whether a property can be iterated over in a for…in loop. If a property is enumerable, it will be listed when you loop through an object’s properties using a for…in loop. The default value of the enumerable property is true. Any property you define on an object is enumerable by default unless you specify otherwise.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Object.defineProperties()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.defineProperties()&lt;/code&gt; is a built-in JavaScript function that allows you to define multiple properties for an object at once. This function takes two arguments: the object you want to define the properties for, and an object that defines the properties.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There’s a &lt;code&gt;Object.defineProperty()&lt;/code&gt; method too, it works similar way for similar use cases just that it can define a single property at a time.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myObj = {};

Object.defineProperties(myObj, {
  name: {
    value: "Max",
    writable: false
  },
  age: {
    value: 30,
    writable: true
  }
});
console.log(myObj);  // prints {name: "Max", age: 30}

myObj.name = "John"; // throws an error

myObj.age = 31;
console.log(myObj.age); // prints 31
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;Now, how is it different than assigning properties with dot notation, you might ask :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Object.defineProperties()&lt;/code&gt; allows you to define multiple properties at once, whereas assigning key and values with dot notation can only set one property at a time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Object.defineProperties()&lt;/code&gt; provides greater control over the behavior of properties. For example, you can set properties to be read-only or non-enumerable, which is not possible with dot notation.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  Object.keys()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.keys()&lt;/code&gt; is a built-in JavaScript function that returns an array of a given object’s property names. &lt;code&gt;Object.keys()&lt;/code&gt; can be useful when you need to loop through an object's properties or access a specific property by name. It's also a handy way to check if an object has any properties at all, as the returned array will be empty if the object has no enumerable properties.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There’s a method &lt;code&gt;Object.getOwnPropertyNames()&lt;/code&gt; which returns an array of all the object’s property names, regardless of whether they are enumerable or not. This includes properties created using &lt;code&gt;Object.defineProperty()&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myObj = { name: "Sarvesh", age: 24};

const keys = Object.keys(myObj); //returns ["name", "age"]

Object.defineProperty(myObj, "city", {
  value: "Mumbai",
  enumerable: false,
});
console.log(Object.getOwnPropertyNames(obj)); // Output: ["name", "age", "city"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.values()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.values()&lt;/code&gt; is a built-in function in JavaScript that allows you to extract the values of an object’s properties and return them in an array.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myObj = { name: "Sarvesh", age: 24, city: "Mumbai" };

const values = Object.values(myObj); // returns [ 'Sarvesh', 24, 'Mumbai' ]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.entries()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.entries()&lt;/code&gt; method is a built-in function in JavaScript that allows you to get an array of all the property key-value pairs of an object. The returned array contains sub-arrays, where each sub-array represents a property of the object and consists of two elements: the property name (key) and the corresponding value.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myObj = { name: "Sarvesh", age: 24, city: "Mumbai" };

const entries= Object.entries(myObj); 
// returns [[ 'name', 'Sarvesh' ], [ 'age', 24 ], [ 'city', 'Mumbai' ]]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.fromEntries()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.fromEntries()&lt;/code&gt; is a built-in JavaScript function that creates an object from an array of key-value pairs. It takes an iterable (such as an array) containing key-value pairs and returns a new object with those pairs as properties. &lt;strong&gt;So basically, it's just the reverse of &lt;code&gt;Object.entries()&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const entries = [["name", "Max"], ["age", 30], ["city", "Mumbai"]];

const obj = Object.fromEntries(entries);
console.log(obj); // output: { name: "Max", age: 30, city: "Mumbai" }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.assign()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.assign()&lt;/code&gt; is a way to combine the properties of different objects into a new object without changing the original objects. This function is useful when you need to merge two or more objects into a single object.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj1 = { a: 1, b: 2 };
const obj2 = { c: 3, d: 4 };

const mergedObj = Object.assign(obj1, obj2);
// returns {a: 1, b: 2, c: 3, d: 4}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.freeze()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.freeze()&lt;/code&gt; is a built-in function that freezes an object, preventing any modifications to its properties. This function is useful when you want to prevent accidental changes to an object.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myObj = { name: "John", age: 30, city: "New York" };
Object.freeze(myObj);

myObj.name = "Jane"; 
// throws an error because the object is frozen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.isFrozen()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.isFrozen()&lt;/code&gt; determines if an object is frozen.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = {}
Object.isFrozen(obj) // false

Object.freeze(obj)

Object.isFrozen(obj) //true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.seal()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.seal()&lt;/code&gt; is a built-in function that seals an object, preventing the addition or removal of properties.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now how is this different from &lt;code&gt;Object.freeze()&lt;/code&gt;, you might ask:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Object.freeze()&lt;/code&gt; is more restrictive than &lt;code&gt;Object.seal()&lt;/code&gt;When an object is frozen, its properties cannot be added, deleted, or modified in any way. When an object is sealed, its properties can still be modified, but they cannot be added or deleted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;Object.freeze()&lt;/code&gt; affects all levels of an object’s properties, while &lt;code&gt;Object.seal()&lt;/code&gt; only affects the object’s immediate properties. This means that if an object has nested objects as properties, &lt;code&gt;Object.freeze()&lt;/code&gt; will prevent changes to those nested objects as well.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In layman's language, freezing an object means that its properties cannot be changed, while sealing an object only prevents the addition or deletion of properties.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myObj = { name: "Sarvesh", age: 24, city: "Mumbai" };
Object.seal(myObj);

myObj.name = "Max"; // allowed with seal, not with freeze
myObj.gender = "Male"; // throws an error because the object is sealed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.isSealed()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.isSealed()&lt;/code&gt; determines if an object is sealed.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = {}
Object.isSealed(obj) // false

Object.seal(obj)

Object.isSealed(obj) // true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.create()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.create()&lt;/code&gt; is a built-in function in JavaScript that creates a new object with the specified prototype object and properties.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const person = {
  name: "",
  age: 0,
  greet: function() {
    console.log(`Hi, my name is ${this.name} and I'm ${this.age} years old.`);
  }
};

const john = Object.create(person);
john.name = "Max";
john.age = 24;

john.greet(); // Output: Hi, my name is Max and I'm 24years old.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;In this example, we create an object person with three properties: name, age, and greet. We then create a new object john using &lt;code&gt;Object.create(person)&lt;/code&gt;, which sets person as the prototype object for john. This means that john inherits all the properties and methods of person.&lt;/p&gt;

&lt;p&gt;We then set the name and age properties of john, and call the greet method, which outputs a message using the name and age properties of the john object.&lt;/p&gt;


&lt;h2&gt;
  
  
  Object.getPrototypeOf()
&lt;/h2&gt;

&lt;p&gt;As &lt;code&gt;Object.create()&lt;/code&gt; creates a new object with the specified prototype, &lt;code&gt;Object.getPrototypeOf()&lt;/code&gt; returns the prototype of an object. Therefore, we can say that &lt;code&gt;Object.getPrototypeOf()&lt;/code&gt; is the reverse of &lt;code&gt;Object.create()&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const proto = { a: 1 }
const obj = Object.create(proto)

obj.b = 2 // obj = { b: 2 }
Object.getPrototypeOf(obj) // { a: 1 }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.getOwnPropertyDescriptor()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.getOwnPropertyDescriptor()&lt;/code&gt; is a built-in function in JavaScript that returns an object containing the descriptor for a specific property of an object. The descriptor provides information about the property, such as whether it is writable or enumerable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There’s a &lt;code&gt;Object.getOwnPropertyDescriptors()&lt;/code&gt; method too, it works similar way for similar use cases just that it can define multiple properties of the object at a time.&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myObj = {
  name: 'Max',
  age: 30,
  city: 'Mumbai'
};

const descriptor = Object.getOwnPropertyDescriptor(myObj, 'name');

console.log(descriptor);
//returns { value: 'Max', writable: true, enumerable: true, configurable: true }


const descriptorS = Object.getOwnPropertyDescriptors(myObj)

console.log(descriptors)
//Outputs
{
//   name: { value: 'Max', writable: true, enumerable: true, configurable: true },
//   age: { value: 30, writable: true, enumerable: true, configurable: true },
//   city: { value : "Mumbai", writable:true, enumerable: true, configurable: true }
// }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.preventExtensions()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.preventExtensions()&lt;/code&gt; is a built-in function in JavaScript that prevents new properties from being added to an object.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = { a: 1 }
Object.preventExtensions(obj)

Object.defineProperty(obj, 'b', { value: 2 }) //throws an error
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.isExtensible()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.isExtensibles()&lt;/code&gt; is a built-in function in JavaScript that determines whether an object can have new properties added to it.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = {}
Object.isExtensible(obj) // true

Object.preventExtensions(obj)

Object.isExtensible(obj) // false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.prototype.hasOwnProperty()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.prototype.hasOwnProperty()&lt;/code&gt; is a built-in function in JavaScript that returns boolean indicating whether an object has the specified property.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = { a: 1 }

obj.hasOwnProperty('a') // true
obj.hasOwnProperty('b') // false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.prototype.isPrototypeOf()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.prototype.isPrototypeOf()&lt;/code&gt; is a built-in function in JavaScript that checks if an object exists in another object’s prototype chain.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const proto = { a: 1 }

const obj = Object.create(proto)
proto.isPrototypeOf(obj) // true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Object.prototype.propertyIsEnumerable()
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;Object.prototype.propertyIsEnumerable()&lt;/code&gt; is a built-in function in JavaScript that checks if object exists in another object’s prototype chain.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const obj = { a: 1 }
const arr = ['a']

obj.propertyIsEnumerable('a') // true
arr.propertyIsEnumerable(0) // true
arr.propertyIsEnumerable('length') // false
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object"&gt;&lt;strong&gt;Object - JavaScript | MDN&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You may check if an Object method is still supported by a range of browsers or is redundant on :&lt;br&gt;
&lt;a href="https://caniuse.com/"&gt;&lt;strong&gt;Can I use... Support tables for HTML5, CSS3, etc&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, understanding the various methods available on the Object prototype in JavaScript is essential for writing clean and efficient code.&lt;/p&gt;

&lt;p&gt;In this blog post, we’ve covered a wide range of methods available on the Object prototype, including &lt;code&gt;Object.keys()&lt;/code&gt;, &lt;code&gt;Object.values()&lt;/code&gt;, &lt;code&gt;Object.entries()&lt;/code&gt;, &lt;code&gt;Object.assign()&lt;/code&gt;, &lt;code&gt;Object.freeze()&lt;/code&gt;, &lt;code&gt;Object.seal()&lt;/code&gt;, &lt;code&gt;Object.create()&lt;/code&gt;, &lt;code&gt;Object.defineProperty()&lt;/code&gt;, &lt;code&gt;Object.defineProperties()&lt;/code&gt;, &lt;code&gt;Object.getPrototypeOf()&lt;/code&gt;, &lt;code&gt;Object.setPrototypeOf()&lt;/code&gt;, and Object.is(). By understanding the purpose and functionality of each of these methods, developers can make more informed decisions about which methods to use in their code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Subscribe to my (free) weekly newsletter about writing and web development — &lt;a href="https://sarveshh.beehiiv.com/subscribe"&gt;https://sarveshh.beehiiv.com/subscribe&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you liked this, you might enjoy:&lt;br&gt;
&lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;a href="https://bootcamp.uxdesign.cc/mastering-css-flexbox-basics-to-advanced-techniques-365c5fcbcf93" rel="noopener noreferrer"&gt;
      bootcamp.uxdesign.cc
    &lt;/a&gt;
&lt;/div&gt;




&lt;div class="ltag__link"&gt;
  &lt;a href="https://sarveshh.medium.com/a-comprehensive-guide-to-next-js-routing-5fb426678bf7" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WKMdOFbQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://miro.medium.com/v2/resize:fill:96:96/1%2AqMsRUSbtVQjpKTZZluNQsQ.png" alt="Sarvesh"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://sarveshh.medium.com/a-comprehensive-guide-to-next-js-routing-5fb426678bf7" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;A Comprehensive guide to Next.JS routing | by Sarvesh | Mar, 2023 | Medium&lt;/h2&gt;
      &lt;h3&gt;Sarvesh ・ &lt;time&gt;Mar 10, 2023&lt;/time&gt; ・ 
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hnDHPsJs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/medium-f709f79cf29704f9f4c2a83f950b2964e95007a3e311b77f686915c71574fef2.svg" alt="Medium Logo"&gt;
        sarveshh.Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Next.js Routing: A Comprehensive Guide to Building Single-Page Applications</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Sat, 04 Mar 2023 09:02:02 +0000</pubDate>
      <link>https://dev.to/sarveshh/nextjs-routing-a-comprehensive-guide-to-building-single-page-applications-3l90</link>
      <guid>https://dev.to/sarveshh/nextjs-routing-a-comprehensive-guide-to-building-single-page-applications-3l90</guid>
      <description>&lt;p&gt;Next.js is a powerful framework that makes building single-page applications (SPAs) easy and intuitive. One of its key features is its built-in routing system, which allows you to create complex navigation structures and manage page transitions with ease. In this article, we’ll explore Next.js routing and show you how to use it to build SPAs that are fast, responsive, and easy to navigate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to Next.js routing
&lt;/h2&gt;

&lt;p&gt;Next.js routing is a built-in feature that allows you to create single-page applications that are fast, responsive, and easy to navigate. It supports &lt;strong&gt;traditional routing, dynamic routing, nested routing, and custom routes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Traditional routing&lt;/em&gt; is based on the file system, where each file inside the pages directory represents a route. &lt;em&gt;Dynamic routing&lt;/em&gt; allows you to create pages with variable parameters. &lt;em&gt;Nested routing *enables you to create complex navigation structures. *Custom routes&lt;/em&gt; allow you to create custom URL structures. By leveraging Next.js routing, you can manage page transitions, trigger animations or other effects, and create SEO-friendly URLs.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore each type of routing in detail and show you how to use them to build engaging and dynamic single-page applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Static Routing&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Static routing&lt;/strong&gt; is the most basic and straightforward way of defining routes. It is based on the file system, where each file inside the pages directory represents a route. This means that when you create a new file in the pages directory, it automatically becomes a new route in your application. Static routing is ideal for simple applications that don't require dynamic content.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s say you want to create a simple application that has three pages: home, about, and contact. To do this, you would create three files in the pages directory: index.js, about.js, and contact.js. The index.js file would represent the home page, the about.js file would represent the about page, and the contact.js file would represent the contact page.&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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A6KQmK0iBOsoi9Q5PhJWf_g.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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A6KQmK0iBOsoi9Q5PhJWf_g.png" alt="Static routing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When you run the application and navigate to the root URL, Next.js will automatically render the index.js file and display the home page. If you navigate to /about, Next.js will render the about.js file and display the about page, and so on. This is the basic concept of static routing in Next.js.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Dynamic Routing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Dynamic routing&lt;/strong&gt; is a more advanced feature in Next.js that allows you to create pages with variable parameters. This means that you can create pages that display different content based on the URL parameters. Dynamic routing is achieved by using square brackets in the file name, like [id].js, and then using the useRouter hook to access the dynamic parameters and fetch data based on them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s say you want to create a blog application where each blog post has a unique ID. Instead of creating a new file for each blog post, you can use dynamic routing to create a single file that displays the content for each blog post based on the ID in the URL. To do this, you would create a file called blog/[id].js in the pages directory.&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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AOGqlgJZCbrdt8ZJZcqIUYQ.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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2AOGqlgJZCbrdt8ZJZcqIUYQ.png" alt="Dynamic routing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When a user navigates to /blog/123, Next.js will render the blog/[id].js file and pass the value 123 as a parameter. You can then use the useRouter hook to access the id parameter and fetch the content for the blog post with that ID. This allows you to create a dynamic and scalable blog application without the need for creating a new file for each blog post.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Nested Routing
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Nested routing&lt;/strong&gt; in Next.js allows you to create complex navigation structures by nesting routes inside each other. This means that you can create pages that are accessible through multiple URLs, and also have multiple pages inside a single parent page. Nested routing is achieved by creating subdirectories inside the pages directory, and then creating files inside those subdirectories to represent the nested routes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s say you have a product catalog application where each product belongs to a specific category and has a unique ID. You can use nested routing to create a structure like /products/category-1/123, /products/category-2/456, etc. To do this, you would create a subdirectory called products inside the pages directory, and then create a subdirectory inside products called [category]. Inside the [category] subdirectory, you would create a file called [id].js.&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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A8pkleRx9VVaVg3cuF0oZYw.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%2Fcdn-images-1.medium.com%2Fmax%2F2000%2F1%2A8pkleRx9VVaVg3cuF0oZYw.png" alt="Nested routing"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When a user navigates to /products/category-1/123, Next.js will render the products/[category]/[id].js file and pass the values category-1 and 123 as parameters. You can then use the useRouter hook to access the category and id parameters and fetch the details for that specific product. This allows you to create a dynamic and scalable product catalog application with nested routing in Next.js.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Custom Routes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Custom routing&lt;/strong&gt; in Next.js allows you to define your own routing rules and patterns for your application. This means that you can create custom URLs that don’t follow the default routing rules in Next.js. Custom routing is achieved by defining a rewrites property in the next.config.js file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s say you want to create a custom URL for a specific page in your application. You can define a rewrite rule in next.config.js that maps the custom URL to the actual page in your application.&lt;/p&gt;

&lt;p&gt;Here’s an example of how to create a custom URL /about for the pages/about.js page:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

    // next.config.js

    module.exports = {
      async rewrites() {
        return [
          {
            source: '/about',
            destination: '/about',
          },
        ];
      },
    };


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;When a user navigates to /about, Next.js will rewrite the URL to match the destination and render the pages/about.js page. This allows you to create custom URLs that are easy to remember and share with others.&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;p&gt;Next.js routing is a powerful tool for building SPAs that are fast, responsive, and easy to navigate. By leveraging its built-in routing system, you can create complex navigation structures, manage page transitions, and customize your URL structure to fit your application's needs. By following the examples and tips outlined in this article, you can take your Next.js application to the next level and create an engaging user experience for your audience.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to optimise SEO in NextJs</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Tue, 28 Feb 2023 18:13:42 +0000</pubDate>
      <link>https://dev.to/sarveshh/next-level-seo-how-to-get-your-nextjs-app-to-rank-higher-5g1e</link>
      <guid>https://dev.to/sarveshh/next-level-seo-how-to-get-your-nextjs-app-to-rank-higher-5g1e</guid>
      <description>&lt;p&gt;In a digital world where visibility is everything, it’s crucial to optimize your website for search engine rankings. If you’re using Next.js to build your web app, this guide will show you the best practices to increase your website’s SEO. From meta tags and structured data to dynamic imports and server-side rendering, this article will help you make your Next.js app more search engine-friendly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Search Engine Optimization (SEO) is an essential part of web development. The goal is to make your website more visible to search engines and increase traffic to your site. While there are many factors that contribute to good SEO, optimizing your Next.js app for SEO can be a bit tricky. In this article, we will explore some of the best practices for optimizing your Next.js app for SEO.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Meta tags&lt;/strong&gt;&lt;br&gt;
Meta tags are HTML tags that describe the content of a webpage. They provide search engines with important information about your page, such as the title, description, and keywords. In Next.js, you can use the “Head” component to add meta tags to your pages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  import Head from 'next/head'

    function MyPage() {
      return (
        &amp;lt;div&amp;gt;
          &amp;lt;Head&amp;gt;
            &amp;lt;title&amp;gt;My Page Title&amp;lt;/title&amp;gt;
            &amp;lt;meta name="description" content="This is a description of my page." /&amp;gt;
            &amp;lt;meta name="keywords" content="my, page, keywords" /&amp;gt;
            &amp;lt;meta name="robots" content="index, follow" /&amp;gt;
            &amp;lt;meta name="author" content="My Name" /&amp;gt;
            &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&amp;gt;
          &amp;lt;/Head&amp;gt;
          &amp;lt;p&amp;gt;This is my page content.&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      )
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;title&lt;/code&gt; tag is the most important meta tag for SEO, as it tells search engines what the page is about. The &lt;code&gt;description&lt;/code&gt; tag provides a short description of the page, and the &lt;code&gt;keywords&lt;/code&gt; tag lists the main keywords associated with the page. The &lt;code&gt;robots&lt;/code&gt; tag tells search engine robots whether or not to index the page and whether or not to follow the links on the page. The &lt;code&gt;author&lt;/code&gt; tag can be used to specify the author of the page, and the &lt;code&gt;viewport&lt;/code&gt; tag specifies how the page should be scaled on different devices.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Next.js provides the &lt;code&gt;Head&lt;/code&gt; component, which is a built-in component that allows you to set the head tags of a page. The &lt;code&gt;Head&lt;/code&gt; component is similar to setting the head tag in React, but it has &lt;strong&gt;some advantages&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Server-side rendering:&lt;/strong&gt; When you use the &lt;code&gt;Head&lt;/code&gt; component in Next.js, the head tags are rendered on the server and sent to the client as part of the HTML document. This can improve the performance of your app, as the browser can start rendering the page immediately, without waiting for JavaScript to execute.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dynamic head tags:&lt;/strong&gt; With the &lt;code&gt;Head&lt;/code&gt; component, you can set head tags dynamically based on the state of your app. This can be useful if you need to set different meta tags for different pages or based on user input.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SEO optimization:&lt;/strong&gt; The &lt;code&gt;Head&lt;/code&gt; component provides a convenient way to set meta tags that can help with SEO. By setting the &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;description&lt;/code&gt;, and &lt;code&gt;keywords&lt;/code&gt; tags, you can provide search engines with valuable information about your page that can help it rank higher in search results.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Multiple head tags:&lt;/strong&gt; The ability to use the &lt;code&gt;Head&lt;/code&gt; component in multiple pages and the built-in server-side rendering in Next.js makes it easier to maintain and update the head tags across a large website or web application. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Implement Structured Data&lt;/strong&gt;&lt;br&gt;
Structured data is a type of data that is organized in a specific way to help search engines understand the content of your webpage. This can improve your chances of appearing in rich snippets, which are more prominent search results that include additional information such as ratings, reviews, and images.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    import Head from 'next/head'

    function MyPage() {
      const structuredData = {
        "@context": "https://schema.org",
        "@type": "Product",
        "name": "My Product",
        "image": "https://example.com/my-product.jpg",
        "description": "This is my product description.",
        "sku": "1234567890",
        "brand": {
          "@type": "Brand",
          "name": "My Brand"
        },
        "offers": {
          "@type": "Offer",
          "url": "https://example.com/my-product",
          "priceCurrency": "USD",
          "price": "10.00",
          "availability": "https://schema.org/InStock"
        }
      };

      return (
        &amp;lt;div&amp;gt;
          &amp;lt;Head&amp;gt;
            &amp;lt;script
              type="application/ld+json"
              dangerouslySetInnerHTML={{ __html: JSON.stringify(structuredData) }}
            /&amp;gt;
          &amp;lt;/Head&amp;gt;
          &amp;lt;p&amp;gt;This is my page content.&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      )
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Optimize Images&lt;/strong&gt;&lt;br&gt;
Images can have a big impact on your website’s SEO. By optimizing your images for search engines, you can improve your chances of appearing in image search results. To optimize your images, you should make sure they are properly sized, compressed, and have descriptive file names and alt tags.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Image from 'next/image'

    function MyPage() {
      return (
        &amp;lt;div&amp;gt;
          &amp;lt;h1&amp;gt;My Page&amp;lt;/h1&amp;gt;
          &amp;lt;Image
            src="/my-image.jpg"
            alt="My Image"
            width={500}
            height={300}
          /&amp;gt;
          &amp;lt;p&amp;gt;This is my page content.&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      )
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;In this example, we’re using the &lt;code&gt;next/image&lt;/code&gt; component to display an image on the page. We've specified the &lt;code&gt;src&lt;/code&gt; attribute as the URL of the image file, and we've also set the &lt;code&gt;alt&lt;/code&gt; attribute for accessibility purposes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code&gt;next/image&lt;/code&gt; component also provides several benefits over using a regular &lt;code&gt;img&lt;/code&gt; tag:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic optimization:&lt;/strong&gt; The &lt;code&gt;next/image&lt;/code&gt; component automatically optimizes images by compressing and resizing them to the appropriate size. This can reduce the file size of the image and improve the performance of your app.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lazy loading:&lt;/strong&gt; The &lt;code&gt;next/image&lt;/code&gt; component also supports lazy loading, which means that the image is only loaded when it becomes visible on the screen. This can improve the initial page load time and reduce the amount of data that needs to be downloaded by the user.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic format selection:&lt;/strong&gt;The &lt;code&gt;next/image&lt;/code&gt; component automatically selects the best image format based on the user's browser and device. This can improve the performance of your app by reducing the file size of the image and ensuring that it's displayed correctly on all devices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic quality selection:&lt;/strong&gt; The &lt;code&gt;next/image&lt;/code&gt; component automatically selects the optimal image quality based on the user's device and connection speed. This can ensure that the image is displayed at the highest possible quality without sacrificing performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automatic caching:&lt;/strong&gt; The &lt;code&gt;next/image&lt;/code&gt; component automatically caches images on the server and the client, which can improve the performance of your app by reducing the number of requests to the server.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Use Dynamic Imports&lt;/strong&gt;&lt;br&gt;
Dynamic imports are a powerful feature of Next.js that can help improve your website’s performance and SEO. By using dynamic imports, you can load JavaScript code and components only when they are needed. This can help reduce the initial load time of your page, which is important for both user experience and SEO.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import dynamic from 'next/dynamic'

    const MyComponent = dynamic(
      () =&amp;gt; import('../components/MyComponent'),
      { ssr: false }
    )

    function MyPage() {
      return (
        &amp;lt;div&amp;gt;
          &amp;lt;MyComponent /&amp;gt;
          &amp;lt;p&amp;gt;This is my page content.&amp;lt;/p&amp;gt;
        &amp;lt;/div&amp;gt;
      )
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;Implement Server-Side Rendering&lt;/strong&gt;&lt;br&gt;
Server-side rendering (SSR) is a technique that can improve your website’s SEO by rendering your pages on the server before sending them to the client. This can improve the speed and performance of your website, as well as make it more search engine-friendly. In Next.js, you can use the “getServerSideProps” function to implement SSR.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    function MyPage(props) {
      return (
        &amp;lt;div&amp;gt;
          &amp;lt;p&amp;gt;This is my page content.&amp;lt;/p&amp;gt;
          &amp;lt;ul&amp;gt;
            {myData.map((item) =&amp;gt; (
              &amp;lt;li key={item.id}&amp;gt;{item.name}&amp;lt;/li&amp;gt;
            ))}
          &amp;lt;/ul&amp;gt;
        &amp;lt;/div&amp;gt;
      )
    }

 export async function getServerSideProps(context) {
      const res = await fetch('https://api.example.com/my-data')
      const data = await res.json()

      return {
        props: {
          myData: data
        }
      }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;The &lt;code&gt;getServerSideProps&lt;/code&gt; function is a special function in Next.js that runs on the server every time a page is requested. It fetches data from an external API and passes it to the &lt;code&gt;MyPage&lt;/code&gt;component as a prop.&lt;br&gt;
 The &lt;code&gt;MyPage&lt;/code&gt; component receives the &lt;code&gt;myData&lt;/code&gt; prop and renders it as an unordered list using the map function. Each item in the list is a li element with the name property of the &lt;code&gt;myData&lt;/code&gt; object as its content.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This example demonstrates how to implement server-side rendering (SSR) in a Next.js app. By fetching data on the server and passing it to the component as a prop, the data is available when the page is first loaded, making it more SEO-friendly than if the data were fetched client-side.&lt;/p&gt;
&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Optimizing your Next.js app for SEO can be challenging, but it’s worth the effort. By following these best practices, you can help search engines understand your content and improve your website’s visibility. By including meta tags, implementing structured data, optimizing images, using dynamic imports, and implementing server-side rendering, you can give your website a boost in search engine rankings.&lt;/p&gt;

&lt;p&gt;Thank you for reading this far. Subscribe to my newsletter for posts just like this.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--1lRvgrS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/thumbnail/f1a9ebb4-72fd-41d3-820c-2caf612807b9/landscape_Untitled_design.png" height="462" class="m-0" width="880"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" rel="noopener noreferrer" class="c-link"&gt;
          Subscribe | The Pen, Pixel &amp;amp; Profit Club
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Join 1,187+ coders, entrepreneurs, and creators for a weekly newsletter featuring web dev tips, business case studies, how-to stories, writing deconstructions, and genius AI tools with usage instructions. Get inspiration and practical advice for your projects. Sign up now!
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BoOcTEVH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/logo/f1a9ebb4-72fd-41d3-820c-2caf612807b9/thumb_Untitled_design__1_.png" width="200" height="200"&gt;
        sarveshh.beehiiv.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>nextjs</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Implement ARIA Tags for Better Accessibility: A Comprehensive Guide for Web Developers</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Mon, 27 Feb 2023 07:20:06 +0000</pubDate>
      <link>https://dev.to/sarveshh/how-to-implement-aria-tags-for-better-accessibility-a-comprehensive-guide-for-web-developers-h3k</link>
      <guid>https://dev.to/sarveshh/how-to-implement-aria-tags-for-better-accessibility-a-comprehensive-guide-for-web-developers-h3k</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;As web developers, it’s essential to make sure your website is accessible to everyone. One of the ways to achieve this is by implementing Accessible Rich Internet Applications (ARIA) tags. ARIA tags are HTML attributes that help make web content more accessible to people with disabilities. In this blog post, we’ll cover everything you need to know about implementing ARIA tags, from the basics to advanced topics.&lt;/p&gt;

&lt;p&gt;Let’s start with the basics. &lt;em&gt;ARIA tags are designed to provide additional information to assistive technology, such as screen readers. They help users with disabilities understand the content on your website better.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Some basic ARIA tags that you can start using today include:&lt;/p&gt;

&lt;h3&gt;
  
  
  ARIA labels and descriptions
&lt;/h3&gt;

&lt;h3&gt;
  
  
  aria-label
&lt;/h3&gt;

&lt;p&gt;This attribute is used to provide an accessible name for an element that would otherwise not have a name. You can use this attribute to label buttons, links, and form controls.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button aria-label="Search" type="submit"&amp;gt;Search&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  aria-labelledby
&lt;/h3&gt;

&lt;p&gt;This attribute is used to provide an accessible name for an element that is related to another element on the page. The value of this attribute should be the ID of the element that provides the accessible name.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;label id="searchLabel"&amp;gt;Search:&amp;lt;/label&amp;gt;
&amp;lt;input type="text" aria-labelledby="searchLabel"&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  aria-describedby
&lt;/h3&gt;

&lt;p&gt;This attribute is used to provide additional information about an element, such as instructions or descriptions. The value of this attribute should be the ID of the element that provides the additional information&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;label for="password"&amp;gt;Password:&amp;lt;/label&amp;gt;
&amp;lt;input type="password" id="password" aria-describedby="passwordDesc"&amp;gt;
&amp;lt;span id="passwordDesc"&amp;gt;Please enter a password that is at least 8 characters long.&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  ARIA roles
&lt;/h3&gt;

&lt;p&gt;ARIA roles are a set of predefined attributes that can be used in HTML and JavaScript to define the role or function of an element on a web page.&lt;br&gt;&lt;br&gt;
In JavaScript, ARIA roles can be added to elements using the setAttribute() method, which allows you to specify the role for the element.&lt;/p&gt;

&lt;p&gt;By setting the role of an element to the appropriate ARIA role, you can ensure that it is properly identified by assistive technologies and provide a more accessible user experience. It’s important to note that ARIA roles should only be used when necessary, and should be used in conjunction with other accessibility best practices to ensure that your website is fully accessible to all users.&lt;/p&gt;
&lt;h3&gt;
  
  
  role=”button”
&lt;/h3&gt;

&lt;p&gt;The button role is for clickable elements that trigger a response when activated by the user.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const myDiv = document.getElementById("myDiv");
myDiv.setAttribute("role", "button");

//OR

&amp;lt;div role="button"&amp;gt;Search&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;More examples of roles that can be assigned to elements are:&lt;/p&gt;
&lt;h3&gt;
  
  
  role=”heading”
&lt;/h3&gt;

&lt;p&gt;The heading role indicates that an element is a heading, and the aria-level attribute can be used to indicate the level of the heading (1 through 6).&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;h1 role="heading" aria-level="1" &amp;gt;This is a heading&amp;lt;/h1&amp;gt;
&amp;lt;h2 role="heading" aria-level="2" &amp;gt;This is a heading&amp;lt;/h2&amp;gt;
&amp;lt;h3 role="heading" aria-level="3" &amp;gt;This is a heading&amp;lt;/h3&amp;gt;
&amp;lt;h4 role="heading" aria-level="4" &amp;gt;This is a heading&amp;lt;/h4&amp;gt;
&amp;lt;h5 role="heading" aria-level="5" &amp;gt;This is a heading&amp;lt;/h5&amp;gt;
&amp;lt;h6 role="heading" aria-level="6" &amp;gt;This is a heading&amp;lt;/h6&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  role=”link”
&lt;/h3&gt;

&lt;p&gt;The link role indicates that an element is a hyperlink, and the href attribute can be used to specify the target URL.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button href="https://example.com" role="link"&amp;gt;Link Text&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  role=”menu”
&lt;/h3&gt;

&lt;p&gt;The role menu indicates that an element is a menu, and the aria-orientation attribute can be used to specify the orientation of the menu (horizontal or vertical).&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;ul role="menu" aria-orientation="horizontal"&amp;gt;
  &amp;lt;li role="menuitem"&amp;gt;&amp;lt;a href="#"&amp;gt;Menu Item 1&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
  &amp;lt;li role="menuitem"&amp;gt;&amp;lt;a href="#"&amp;gt;Menu Item 2&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
  &amp;lt;li role="menuitem"&amp;gt;&amp;lt;a href="#"&amp;gt;Menu Item 3&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  role=”progressbar”
&lt;/h3&gt;

&lt;p&gt;The role progressbar indicates that an element is a progress bar, and the aria-valuemin, aria-valuenow, and aria-valuemax attributes can be used to specify the current and maximum values of the progress bar.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="50"&amp;gt;50%&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  role=”radiogroup”
&lt;/h3&gt;

&lt;p&gt;The role radiogroup indicates that an element is a group of radio buttons, and the aria-checked attribute can be used to specify the currently selected radio button.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div role="radiogroup"&amp;gt;
  &amp;lt;label&amp;gt;&amp;lt;input type="radio" name="option" role="radio" aria-checked="true"&amp;gt; Option 1&amp;lt;/label&amp;gt;
  &amp;lt;label&amp;gt;&amp;lt;input type="radio" name="option" role="radio"&amp;gt; Option 2&amp;lt;/label&amp;gt;
  &amp;lt;label&amp;gt;&amp;lt;input type="radio" name="option" role="radio"&amp;gt; Option 3&amp;lt;/label&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  role=”region”
&lt;/h3&gt;

&lt;p&gt;The role region indicates that an element is a region of the page, and the aria-label attribute can be used to provide a descriptive label for the region.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div role="region" aria-label="Main Content"&amp;gt;
  &amp;lt;p&amp;gt;This is the main content of the page.&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  role=”search”
&lt;/h3&gt;

&lt;p&gt;The role search indicates that an element is a search field, and the aria-label attribute can be used to provide a label for the search field.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;form role="search"&amp;gt;
  &amp;lt;label for="search"&amp;gt;Search:&amp;lt;/label&amp;gt;
  &amp;lt;input type="text" id="search" name="search" aria-label="Search"&amp;gt;
  &amp;lt;button type="submit"&amp;gt;Submit&amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  ARIA states and properties
&lt;/h3&gt;

&lt;p&gt;ARIA states and properties refer to attributes that can be used to make web content more accessible to users with disabilities. ARIA state can indicate whether an element is expanded or collapsed, or whether it’s selected or not. ARIA properties provide more specific information about an element.&lt;/p&gt;
&lt;h3&gt;
  
  
  aria-hidden
&lt;/h3&gt;

&lt;p&gt;This attribute is used to hide an element from screen readers and other assistive technology. This can be useful for decorative or redundant elements that do not provide any meaningful information.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="decorative" aria-hidden="true"&amp;gt;
  &amp;lt;img src="decorative-image.png" alt=""&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  aria-invalid
&lt;/h3&gt;

&lt;p&gt;This attribute is used to indicate that the value of an input is not valid. This can be useful for form validation and error messages.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;label for="email"&amp;gt;Email:&amp;lt;/label&amp;gt;
&amp;lt;input type="email" id="email" aria-invalid="true" required&amp;gt;
&amp;lt;div class="error-message"&amp;gt;Please enter a valid email address.&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  aria-checked
&lt;/h3&gt;

&lt;p&gt;Indicates whether an element is checked or not&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Using aria-checked with a checkbox --&amp;gt;
&amp;lt;input type="checkbox" id="example-checkbox" aria-checked="false" /&amp;gt;

&amp;lt;!-- Using aria-checked with a button --&amp;gt;
&amp;lt;button id="example-button" aria-checked="true"&amp;gt;Selected&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  aria-disabled
&lt;/h3&gt;

&lt;p&gt;Indicates whether an element is disabled or not.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Using aria-disabled with a button --&amp;gt;
&amp;lt;button id="example-button" aria-disabled="true"&amp;gt;Disabled&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  aria-expanded
&lt;/h3&gt;

&lt;p&gt;Indicates whether an element is expanded or not.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Using aria-expanded with a collapsible section --&amp;gt;
&amp;lt;button id="example-button" aria-expanded="false" aria-controls="example-section"&amp;gt;Expand&amp;lt;/button&amp;gt;
&amp;lt;section id="example-section" aria-hidden="true"&amp;gt;Collapsible content&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  aria-selected
&lt;/h3&gt;

&lt;p&gt;Indicates whether an element is selected or not&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Using aria-selected with a listbox --&amp;gt;
&amp;lt;ul role="listbox"&amp;gt;
  &amp;lt;li role="option" aria-selected="true"&amp;gt;Option 1&amp;lt;/li&amp;gt;
  &amp;lt;li role="option" aria-selected="false"&amp;gt;Option 2&amp;lt;/li&amp;gt;
  &amp;lt;li role="option" aria-selected="false"&amp;gt;Option 3&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  ARIA live regions
&lt;/h3&gt;

&lt;p&gt;ARIA live regions are a set of Accessible Rich Internet Applications (ARIA) attributes that allow web developers to create dynamic, live updates to web content that are accessible to users with disabilities. In JavaScript, ARIA live regions can be used to update portions of a web page without requiring the user to refresh the entire page.&lt;/p&gt;

&lt;p&gt;ARIA live regions are particularly useful for web applications that display real-time information, such as news tickers, chat rooms, or sports scores.&lt;/p&gt;

&lt;p&gt;To use ARIA live regions in JavaScript, developers can use the aria-live attribute to specify the level of importance and the mode of updating the live region. The aria-live attribute has three possible values: "off", "polite", and "assertive".&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The “polite” value indicates that updates to the live region are less urgent and should not interrupt the user’s current task.&lt;/li&gt;
&lt;li&gt;The “assertive” value indicates that updates to the live region are more important and should interrupt the user’s current task.&lt;/li&gt;
&lt;li&gt;The “off” value means that the live region is not active.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Overall, ARIA live regions in JavaScript are a powerful tool for creating more dynamic and accessible web applications, especially for users with disabilities. By using ARIA live regions, developers can ensure that all users, regardless of their abilities, can access and interact with web content in real-time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div id="live-region" aria-live="polite"&amp;gt;
    Initial content.
&amp;lt;/div&amp;gt;
&amp;lt;button onclick="updateLiveRegion()"&amp;gt;Update Live Region&amp;lt;/button&amp;gt;

function updateLiveRegion() {
  var liveRegion = document.getElementById("live-region");
  var newContent = "New content added at " + new Date().toLocaleTimeString();
  liveRegion.innerHTML = newContent;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In this example, there is a div element with an id of "live-region". The aria-live attribute is set to "polite" to indicate that the live region should not interrupt the user's current task. The initial content of the live region is "Initial content".&lt;/p&gt;

&lt;p&gt;When the user clicks the “Update Live Region” button, the updateLiveRegion() function is called. This function gets the div element with an id of "live-region" using the getElementById() method, and then updates the innerHTML property of the element with the current time. Because the aria-live attribute is set to "polite", the updated content is announced by screen readers without interrupting the user's current task.&lt;/p&gt;

&lt;p&gt;This is just a simple example, but it shows how ARIA live regions can be used to provide real-time updates to web content that are accessible to all users, including those with disabilities.&lt;/p&gt;
&lt;h3&gt;
  
  
  ARIA modal dialogs
&lt;/h3&gt;

&lt;p&gt;ARIA modal dialogs are a type of ARIA tag that can be used in JavaScript to create accessible modal dialogs. Modal dialogs are typically used to present information or requests to users that require immediate attention, such as error messages, confirmations, or notifications.&lt;/p&gt;

&lt;p&gt;ARIA modal dialogs are designed to be accessible to users with disabilities, particularly those who use screen readers. They work by temporarily disabling the rest of the page, while the modal dialog is displayed, and by providing information about the dialog to assistive technology. This makes it easier for users with disabilities to understand and interact with the content of the dialog.&lt;/p&gt;

&lt;p&gt;To create an accessible modal dialog using ARIA, you can use the role attribute to define the role of the element as a dialog, and the aria-modal attribute to indicate that it is a modal dialog. You can also use other ARIA attributes to provide additional information about the dialog, such as its title, description, and state.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;button id="open-modal"&amp;gt;Open Modal Dialog&amp;lt;/button&amp;gt;

&amp;lt;div id="modal" role="dialog" aria-modal="true" aria-labelledby="modal-title"&amp;gt;
  &amp;lt;h2 id="modal-title"&amp;gt;Modal Dialog&amp;lt;/h2&amp;gt;
  &amp;lt;p&amp;gt;This is a modal dialog. Press the escape key or click the close button to close the dialog.&amp;lt;/p&amp;gt;
  &amp;lt;button id="close-modal"&amp;gt;Close&amp;lt;/button&amp;gt;
&amp;lt;/div&amp;gt;

const openModalButton = document.getElementById('open-modal');
const closeModalButton = document.getElementById('close-modal');
const modal = document.getElementById('modal');

function openModal() {
  modal.style.display = 'block';
  modal.setAttribute('aria-hidden', 'false');
  document.body.style.overflow = 'hidden';
}

function closeModal() {
  modal.style.display = 'none';
  modal.setAttribute('aria-hidden', 'true');
  document.body.style.overflow = 'auto';
}

openModalButton.addEventListener('click', openModal);
closeModalButton.addEventListener('click', closeModal);
modal.addEventListener('keydown', function(event) {
  if (event.key === 'Escape') {
    closeModal();
  }
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In this example, we have a button that, when clicked, opens a modal dialog. The modal dialog has a role attribute of "dialog" and an aria-modal attribute of "true", which indicate that it is a modal dialog. It also has an aria-labelledby attribute, which references the ID of the title of the dialog, and a close button, which will be used to close the dialog.&lt;/p&gt;

&lt;p&gt;In the JavaScript code, we define functions to open and close the modal dialog, and add event listeners to the buttons and the modal to handle user interaction. When the modal dialog is open, we set the aria-hidden attribute of the rest of the page to "true", which makes it inaccessible to screen readers. We also disable scrolling on the page while the modal is open to prevent users from accidentally interacting with the rest of the page.&lt;/p&gt;

&lt;p&gt;This is just one example of how you can use ARIA modal dialogs in JavaScript. The key is to use the appropriate ARIA attributes to indicate that the element is a modal dialog and to provide additional information about the dialog to assistive technology. By doing so, you can make your modal dialogs more accessible to users with disabilities.&lt;/p&gt;
&lt;h3&gt;
  
  
  ARIA tab panels
&lt;/h3&gt;

&lt;p&gt;ARIA tab panels are a way to organize content into tabs, which users can click or tap on to access different sections of a webpage. For example, screen readers can read out the different tabs and their associated content, allowing users with visual impairments to navigate the page more efficiently. ARIA tab panels also provide a more organized and streamlined user interface for all users, improving the overall user experience of a website.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div role="tabpanel" aria-labelledby="tab1"&amp;gt;
  &amp;lt;p&amp;gt;This is the content of the first tab.&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div role="tabpanel" aria-labelledby="tab2"&amp;gt;
  &amp;lt;p&amp;gt;This is the content of the second tab.&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;ul role="tablist"&amp;gt;
  &amp;lt;li role="tab" id="tab1" aria-controls="panel1" tabindex="0"&amp;gt;Tab 1&amp;lt;/li&amp;gt;
  &amp;lt;li role="tab" id="tab2" aria-controls="panel2"&amp;gt;Tab 2&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Best Practices
&lt;/h3&gt;

&lt;p&gt;To ensure that you’re using ARIA tags correctly, it’s essential to follow best practices. Here are some tips to keep in mind when implementing ARIA tags:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Only use ARIA tags when necessary&lt;/li&gt;
&lt;li&gt;Use ARIA tags consistently across your website&lt;/li&gt;
&lt;li&gt;Test your website with assistive technology to ensure that it’s accessible to people with disabilities&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By following these best practices, you can ensure that your website is both accessible and usable for everyone.&lt;/p&gt;
&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In conclusion, implementing ARIA tags is a crucial step in making your website more accessible. By understanding the basics and more advanced topics of ARIA tags, you can make significant improvements in the accessibility of your website. By following best practices, you can ensure that your website is accessible to everyone, regardless of disability or impairment. As an expert in web development, it’s your responsibility to ensure that your website is accessible, and implementing ARIA tags is a great way to achieve this goal.&lt;/p&gt;
&lt;h3&gt;
  
  
  Thank you for reading this far
&lt;/h3&gt;

&lt;p&gt;Subscribe to my &lt;a href="https://sarveshh.beehiiv.com/"&gt;Newsletter&lt;/a&gt; for exciting posts just like this.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--1lRvgrS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/thumbnail/f1a9ebb4-72fd-41d3-820c-2caf612807b9/landscape_Untitled_design.png" height="462" class="m-0" width="880"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" rel="noopener noreferrer" class="c-link"&gt;
          Subscribe | The Pen, Pixel &amp;amp; Profit Club
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Join 1,187+ coders, entrepreneurs, and creators for a weekly newsletter featuring web dev tips, business case studies, how-to stories, writing deconstructions, and genius AI tools with usage instructions. Get inspiration and practical advice for your projects. Sign up now!
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BoOcTEVH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/logo/f1a9ebb4-72fd-41d3-820c-2caf612807b9/thumb_Untitled_design__1_.png" width="200" height="200"&gt;
        sarveshh.beehiiv.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;&lt;a href="https://blog.sarveshpatil.com/"&gt;&lt;em&gt;Originally published at https://blog.sarveshpatil.com&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>design</category>
      <category>ux</category>
    </item>
    <item>
      <title>10 Reasons Why Next.js is the Superior Choice over create-react-app for Your Next Project</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Mon, 27 Feb 2023 07:13:54 +0000</pubDate>
      <link>https://dev.to/sarveshh/10-reasons-why-nextjs-is-the-superior-choice-over-create-react-app-for-your-next-project-1c5i</link>
      <guid>https://dev.to/sarveshh/10-reasons-why-nextjs-is-the-superior-choice-over-create-react-app-for-your-next-project-1c5i</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;Are you a front-end developer looking for the best framework for your next project? If you’re considering React, you might be wondering whether to use create-react-app or Next.js. While create-react-app is a popular option, Next.js has several advantages that make it the superior choice&lt;/p&gt;

&lt;h3&gt;
  
  
  So what is Next.js?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://nextjs.org/docs/getting-started"&gt;Next.js&lt;/a&gt; is an &lt;a href="https://github.com/vercel/next.js/"&gt;open-source&lt;/a&gt; framework built on top of &lt;a href="https://reactjs.org/"&gt;React&lt;/a&gt; that provides out-of-the-box server-side rendering, static site generation, and other features to help improve website performance and SEO. It’s flexible and can be used for a wide range of projects, from simple websites to complex applications. Next.js is easy to use, has a large and active community of developers, and is maintained by Vercel, a cloud platform for building and deploying websites and applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  How server-side rendering faster than client-side rendering?
&lt;/h3&gt;

&lt;p&gt;Server-side rendering is faster than client-side rendering because the server sends a pre-rendered page to the user’s browser instead of waiting for the browser to download and execute JavaScript code to build the page. This results in faster load times, better search engine optimization (SEO), and improved user experience. Next.js makes server-side rendering easy by providing built-in tools and configuration options to help developers optimize the rendering process.&lt;/p&gt;

&lt;h3&gt;
  
  
  10 reasons why you should use Next.js for your next project
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Server-Side Rendering&lt;/strong&gt;
Next.js provides built-in support for server-side rendering, allowing you to pre-render pages on the server and deliver them to the client as HTML, which can improve website performance and SEO. Server-side rendering also makes your website more accessible to users with slow or unreliable internet connections, as it can reduce the amount of time needed to load pages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Static Site Generation&lt;/strong&gt;
Next.js allows you to generate static HTML pages at build time, which means that your website can be delivered faster and more securely, with fewer server requests. This can be especially useful for websites with static content, such as blogs or portfolios.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Routes&lt;/strong&gt;
Next.js makes it easy to create API routes without the need for a separate backend server. This feature can be used to retrieve data from a database, access external APIs, or perform any other server-side logic that your website requires.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automatic Code Splitting&lt;/strong&gt;
Next.js automatically splits your code into smaller chunks, which can speed up your website’s load times. This feature is especially useful for larger projects that require more code, as it can prevent users from having to download the entire website at once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improved Routing&lt;/strong&gt;
Next.js provides improved routing capabilities, including dynamic routes and client-side navigation. With dynamic routes, you can create URLs that match a specific pattern, such as /blog/[slug], which can be used to display different content depending on the URL. Client-side navigation allows users to navigate between pages without reloading the entire website, which can improve user experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image Optimization&lt;/strong&gt;
Next.js automatically optimizes images for faster load times and better user experience. This includes features such as lazy loading, which can delay the loading of images until they are needed, and responsive images, which can be resized based on the size of the user’s device.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TypeScript Support&lt;/strong&gt;
Next.js has excellent support for TypeScript, a typed superset of JavaScript that can help improve code quality and reduce bugs. TypeScript provides advanced features such as type checking and interfaces, which can help catch errors before they occur.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customizable Configuration&lt;/strong&gt;
Next.js allows you to customize its configuration to fit your specific needs. This includes options such as adding custom webpack loaders or configuring the server to use a specific middleware.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Large and Active Community&lt;/strong&gt;
Next.js has a large and active community of developers, who are constantly sharing their experiences and best practices. This can be useful for getting help with specific issues, learning new techniques, or staying up-to-date with the latest developments in the framework.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Easy Deployment&lt;/strong&gt;
Next.js provides easy deployment options, including deployment to Vercel, a cloud platform that specializes in serverless and Jamstack applications. This can make it simple to get your website up and running, without having to worry about server configuration or infrastructure management.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  How to get started?
&lt;/h3&gt;

&lt;p&gt;Pre-requisites&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ReactJs knowledge is a must: In case you don’t know ReactJS, I suggest you learn that first. There are plenty of resources available online, I will mention some of them down here.
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://reactjs.org/docs/getting-started.html"&gt;ReactJs official documentation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=Ke90Tje7VS0&amp;amp;ab_channel=ProgrammingwithMosh"&gt;ReactJs Crash Course&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;NextJs Resources
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/docs/getting-started"&gt;NextJs Official Documentation&lt;/a&gt; is a great place to learn
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=tt3PUvhOVzo&amp;amp;ab_channel=codedamn"&gt;NextJs Crash Course&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Thank you for reading this far
&lt;/h3&gt;

&lt;p&gt;Subscribe to my &lt;a href="https://sarveshh.beehiiv.com/"&gt;Newsletter&lt;/a&gt; for exciting posts just like this.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--1lRvgrS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/thumbnail/f1a9ebb4-72fd-41d3-820c-2caf612807b9/landscape_Untitled_design.png" height="462" class="m-0" width="880"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" rel="noopener noreferrer" class="c-link"&gt;
          Subscribe | The Pen, Pixel &amp;amp; Profit Club
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Join 1,187+ coders, entrepreneurs, and creators for a weekly newsletter featuring web dev tips, business case studies, how-to stories, writing deconstructions, and genius AI tools with usage instructions. Get inspiration and practical advice for your projects. Sign up now!
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BoOcTEVH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/logo/f1a9ebb4-72fd-41d3-820c-2caf612807b9/thumb_Untitled_design__1_.png" width="200" height="200"&gt;
        sarveshh.beehiiv.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://blog.sarveshpatil.com/10-reasons-why-nextjs-is-the-superior-choice-over-create-react-app-for-your-next-project"&gt;&lt;em&gt;https://blog.sarveshpatil.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>nextjs</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Responsive Web Design: Best Practices and Advanced Techniques</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Mon, 27 Feb 2023 07:10:21 +0000</pubDate>
      <link>https://dev.to/sarveshh/responsive-web-design-best-practices-and-advanced-techniques-2ikd</link>
      <guid>https://dev.to/sarveshh/responsive-web-design-best-practices-and-advanced-techniques-2ikd</guid>
      <description>&lt;p&gt;Creating a responsive website that looks great on any device is a must-have for any modern web designer. In this post, we’ll explore the best practices and advanced techniques for responsive web design.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Use a Mobile-First Approach&lt;/strong&gt; With the majority of internet traffic now coming from mobile devices, it’s essential to design for mobile first. This approach helps you focus on the most important content and functionality, and ensures that your website is optimized for smaller screens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Design with a Fluid Grid&lt;/strong&gt;
A fluid grid is an essential component of responsive web design. Instead of using fixed widths for your website’s layout, use a grid system that scales with the screen size. This ensures that your website’s content is always displayed optimally, no matter the screen size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use Media Queries for Targeted Styling&lt;/strong&gt;
Media queries allow you to target specific screen sizes and apply custom styling. Use media queries to create different layouts and styles for different devices, ensuring that your website looks great on all screens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimize Images for Performance&lt;/strong&gt;
Images can significantly impact your website’s performance. To ensure your website loads quickly on all devices, it’s essential to optimize your images. Use image compression tools and choose the right image formats to reduce file size without sacrificing quality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test Your Design on Different Devices&lt;/strong&gt;
To ensure your design is truly responsive, test it on different devices and screen sizes. Use developer tools or testing tools to check how your website looks and performs on different devices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use responsive frameworks and tools&lt;/strong&gt; Utilize frameworks and tools like &lt;a href="https://getbootstrap.com/"&gt;Bootstrap&lt;/a&gt;, or &lt;a href="https://tailwindcss.com/"&gt;TailwindCss&lt;/a&gt; to streamline your responsive design process and ensure cross-browser compatibility. Bootstrap and Tailwind CSS, for instance, offer pre-built components and styles that you can use to easily create a responsive design. These frameworks also handle cross-browser compatibility, which can be a time-consuming aspect of responsive web design. With these tools, you can focus more on creating unique, custom designs that are optimized for all screen sizes, without worrying about compatibility issues.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In conclusion, responsive web design is an essential skill for any modern web designer. With the tips and techniques we’ve explored in this blog post, you can create a responsive website that looks great on any device. From a mobile-first approach to fluid grids and media queries, these best practices will help you take your web design skills to the next level.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank you for reading this far
&lt;/h2&gt;

&lt;p&gt;Subscribe to my &lt;a href="https://sarveshh.beehiiv.com/"&gt;Newsletter&lt;/a&gt; for exciting posts just like this.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--1lRvgrS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/thumbnail/f1a9ebb4-72fd-41d3-820c-2caf612807b9/landscape_Untitled_design.png" height="462" class="m-0" width="880"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" rel="noopener noreferrer" class="c-link"&gt;
          Subscribe | The Pen, Pixel &amp;amp; Profit Club
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Join 1,187+ coders, entrepreneurs, and creators for a weekly newsletter featuring web dev tips, business case studies, how-to stories, writing deconstructions, and genius AI tools with usage instructions. Get inspiration and practical advice for your projects. Sign up now!
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BoOcTEVH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/logo/f1a9ebb4-72fd-41d3-820c-2caf612807b9/thumb_Untitled_design__1_.png" width="200" height="200"&gt;
        sarveshh.beehiiv.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Originally published at&lt;/em&gt; &lt;a href="https://hashnode.com/preview/63ee488b9e450e00085d4aed"&gt;&lt;em&gt;https://blog.sarveshpatil.com&lt;/em&gt;&lt;/a&gt;&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>design</category>
    </item>
    <item>
      <title>Mastering CSS Flexbox: From Basics to Advanced Techniques</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Sat, 18 Feb 2023 10:44:44 +0000</pubDate>
      <link>https://dev.to/sarveshh/mastering-css-flexbox-from-basics-to-advanced-techniques-1foe</link>
      <guid>https://dev.to/sarveshh/mastering-css-flexbox-from-basics-to-advanced-techniques-1foe</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CHCog3Bn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3200/1%2AtiS4RzayAJdIeTEkNL1ztw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CHCog3Bn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3200/1%2AtiS4RzayAJdIeTEkNL1ztw.png" alt="" width="880" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Are you tired of using tables, floats, and other traditional CSS layout methods that just don’t cut it anymore? It’s time to embrace the power of CSS Flexbox! With Flexbox, you can create complex and dynamic layouts that adapt to different screen sizes and device orientations. This tutorial will take you through all the basics of CSS Flexbox and introduce you to advanced techniques for creating truly stunning web designs.&lt;/p&gt;

&lt;p&gt;If you’re the ‘learn by doing’ type, I suggest you check out this game based on flexbox. You’ll understand the whole module in no time.&lt;br&gt;
&lt;a href="https://flexboxfroggy.com/"&gt;&lt;strong&gt;Flexbox Froggy&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Y51pj3oE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/0%2A_p_py_8Z65YnK30T" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Y51pj3oE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/0%2A_p_py_8Z65YnK30T" alt="" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this tutorial, you will learn about the following Flexbox properties and their respective code examples:&lt;/p&gt;
&lt;h2&gt;
  
  
  Flexbox Properties for Parent (container)
&lt;/h2&gt;
&lt;h2&gt;
  
  
  display
&lt;/h2&gt;

&lt;p&gt;Defines the container as a flex container and enables Flexbox properties to be applied to its children.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
    display: flex; /* or inline-flex */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  flex-direction
&lt;/h2&gt;

&lt;p&gt;Sets the direction in which flex items are placed inside the container. Options include row, row-reverse, column, and column-reverse.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WPBjbO9O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/0%2ALt-oTEDOTgELfWqo" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WPBjbO9O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/0%2ALt-oTEDOTgELfWqo" alt="" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  flex-direction: row | row-reverse | column | column-reverse;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  flex-wrap
&lt;/h2&gt;

&lt;p&gt;Determines whether flex items should wrap or not when there is not enough space on the main axis. Options include nowrap, wrap, and wrap-reverse.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;nowrap (default): all flex items will be on one line&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;wrap: flex items will wrap onto multiple lines, from top to bottom.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;wrap-reverse: flex items will wrap onto multiple lines from bottom to top.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;.container {&lt;br&gt;
            flex-wrap: nowrap | wrap | wrap-reverse;&lt;br&gt;
    }&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  flex-flow
&lt;/h2&gt;

&lt;p&gt;Shorthand for setting both flex-direction and flex-wrap at once.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  flex-flow: column wrap;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  justify-content
&lt;/h2&gt;

&lt;p&gt;justify-content is a CSS Flexbox property that aligns flex items along the main axis of the container. It has six possible values:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;flex-start: This value aligns the items to the start of the container. If the container’s main axis is horizontal, the items will be aligned to the left. If the main axis is vertical, the items will be aligned to the top.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;flex-end: This value aligns the items to the end of the container. If the container’s main axis is horizontal, the items will be aligned to the right. If the main axis is vertical, the items will be aligned to the bottom.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;center: This value centers the items along the main axis of the container. If the main axis is horizontal, the items will be centered horizontally. If the main axis is vertical, the items will be centered vertically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;space-between: This value evenly distributes the items along the main axis of the container, with the first item aligned to the start and the last item aligned to the end. The remaining items are spaced evenly between them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;stretch: This value stretches the items to fill the container along the main axis. This means that the items will be expanded or contracted to fill the available space.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;space-around: This value evenly distributes the items along the main axis of the container, with equal spacing between them. There is also spacing at the start and end of the container, so the items are not aligned with the edges.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;.container {&lt;br&gt;
           justify-content: flex-start | flex-end | center | &lt;br&gt;
           space-between | space-around | space-evenly | stretch&lt;br&gt;
    }&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3ValnL1e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/0%2AUTWEU3lXVk3o46Fx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3ValnL1e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/0%2AUTWEU3lXVk3o46Fx.png" alt="" width="880" height="477"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  align-items
&lt;/h2&gt;

&lt;p&gt;The align-items property is used to vertically align the flex items inside the container. Here are the descriptions for each value:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;flex-start: This value aligns the flex items at the top of the container. The items are aligned based on the cross-start margin edge of the flex items.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;flex-end: This value aligns the flex items at the bottom of the container. The items are aligned based on the cross-end margin edge of the flex items.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;center: This value aligns the flex items at the center of the container. The items are aligned based on the midpoint of the cross-start and cross-end margin edges of the flex items.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;stretch: This value stretches the flex items to fill the container vertically. The items are stretched to fit the container height based on their flex-grow and flex-shrink values.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;baseline: This value aligns the flex items such that their baselines align. The items are aligned based on their baseline, which is defined by the font-size and line-height properties.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4DeAdjE4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A2fjvaLzgVnIu39LtfQftOg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4DeAdjE4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2000/1%2A2fjvaLzgVnIu39LtfQftOg.png" alt="" width="490" height="650"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  align-items: stretch | flex-start | flex-end | center | baseline
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  align-content
&lt;/h2&gt;

&lt;p&gt;The align-content property is used to vertically align multiple lines of flex items inside the container when there is extra space along the cross-axis. It only applies when there are multiple lines of flex items, created either by flex-wrap: wrap or when there is not enough space for all items in a single line. Here are the descriptions for each possible value:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;flex-start: This value aligns the lines of flex items at the top of the container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;flex-end: This value aligns the lines of flex items at the bottom of the container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;center: This value centers the lines of flex items vertically in the container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;space-between: This value distributes the lines of flex items evenly along the cross-axis, with the first line at the top of the container and the last line at the bottom.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;space-around: This value distributes the lines of flex items evenly along the cross-axis, with equal space between each line and the top and bottom of the container.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;stretch: This value stretches the lines of flex items to fill the container vertically. The lines are stretched to fit the container height based on their flex-grow and flex-shrink values&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PhBWfgCb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3062/1%2ApN-RV3teU5FgJfTS11hZxg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PhBWfgCb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3062/1%2ApN-RV3teU5FgJfTS11hZxg.jpeg" alt="" width="880" height="1189"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  align-content: flex-start | flex-end | center | space-between | space-around | space-evenly | stretch | start | end | baseline 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  gap, row-gap, column-gap
&lt;/h2&gt;

&lt;p&gt;gap, row-gap, and column-gap are CSS properties used in conjunction with the CSS flexbox layout. These properties allow you to add spacing between flex items in a more efficient way than using margins.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;gap: This property specifies the size of the gap between flex items in both the horizontal and vertical directions. It is a shorthand property for row-gap and column-gap and sets the value for both.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: flex;
  gap: 10px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;This code sets a gap of 10px between all flex items inside the container.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;row-gap: This property specifies the size of the gap between flex items in the vertical direction only.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: flex;
  flex-direction: column;
  row-gap: 10px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;This code sets a gap of 10px between all rows of flex items in the container.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;column-gap: This property specifies the size of the gap between flex items in the horizontal direction only.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: flex;
  column-gap: 10px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;This code sets a gap of 10px between all columns of flex items in the container. Note that this property only works if the flex-wrap property is set to wrap or wrap-reverse.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5Mkwt6nn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3062/1%2ANkLCvqw0UOT6epI3rJhiSA.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5Mkwt6nn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/3062/1%2ANkLCvqw0UOT6epI3rJhiSA.jpeg" alt="" width="880" height="1078"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Flexbox properties for children (items)
&lt;/h2&gt;
&lt;h2&gt;
  
  
  order
&lt;/h2&gt;

&lt;p&gt;The order property is used to change the order of flex items within a container. By default, all flex items have an order value of 0. You can set the order property to a positive or negative integer value to change the order of the flex item.&lt;/p&gt;

&lt;p&gt;Example :&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="container"&amp;gt;
  &amp;lt;div class="item item-1"&amp;gt;1&amp;lt;/div&amp;gt;
  &amp;lt;div class="item item-2"&amp;gt;2&amp;lt;/div&amp;gt;
  &amp;lt;div class="item item-3"&amp;gt;3&amp;lt;/div&amp;gt;
  &amp;lt;div class="item item-4"&amp;gt;4&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

.container {
  display: flex;
  flex-wrap: wrap;
}

.item {
  display: flex;
  justify-content: center;
  align-items: center;
}

.item-1 {
  order: 2;
}

.item-2 {
  order: 1;
}

.item-3 {
  order: 3;
}

.item-4 {
  order: 4;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;In this example, we have a container with four flex items. We use the order property to change the order of the items.&lt;/p&gt;

&lt;p&gt;.item-1 has an order value of 2, which means it will be displayed after .item-2.&lt;/p&gt;

&lt;p&gt;.item-2 has an order value of 1, which means it will be displayed first.&lt;/p&gt;

&lt;p&gt;.item-3 has an order value of 3, which means it will be displayed after .item-1.&lt;/p&gt;

&lt;p&gt;.item-4 has an order value of 4, which means it will be displayed last.&lt;/p&gt;

&lt;p&gt;Using the order property, we can rearrange the order of the flex items inside the container without changing the HTML structure.&lt;/p&gt;
&lt;h2&gt;
  
  
  flex-grow
&lt;/h2&gt;

&lt;p&gt;The flex-grow property is used to specify how much a flex item should grow relative to the other flex items inside the same container. It is a unitless value that represents the proportion of the available space that the item should take up.&lt;/p&gt;

&lt;p&gt;If all items have flex-grow set to 1, the container’s remaining space will be distributed equally to all children. If one of the children has a value of 2, that child will take up twice as much space as the others (or it will try, at least).&lt;/p&gt;

&lt;p&gt;Here is an example:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: flex;
  width: 500px;
}
.item {
  flex-grow: 1;
  background-color: red;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;In this example, the container has a width of 500px and contains three flex items with the class .item. The flex-grow property is set to 1 for each item. This means that each item should take up an equal amount of the available space in the container. Since there are three items, each item will take up one-third of the available space.&lt;/p&gt;

&lt;p&gt;If we add another item to the container and set its flex-grow property to 2, like this:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.container {
  display: flex;
  width: 500px;
}

.item {
  flex-grow: 1;
  background-color: red;
}

.item-4 {
  flex-grow: 2;
  background-color: blue;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;The fourth item will take up twice as much space as the other items, since its flex-grow value is set to 2. This means that it will take up two-fifths of the available space, while the other items will take up one-fifth each.&lt;/p&gt;
&lt;h2&gt;
  
  
  flex-basis
&lt;/h2&gt;

&lt;p&gt;The flex-basis property is used to set the initial size of a flex item before any available space is distributed among the items.&lt;/p&gt;

&lt;p&gt;Here’s an example of how to use flex-basis:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.item {
  flex-basis: 150px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;In this example, the flex-basis property is set to 150px for the .item class. This means that the initial size of the item will be 150px, and any remaining space will be distributed among the other flex items.&lt;/p&gt;

&lt;p&gt;It’s important to note that flex-basis is just one of the properties that controls the size of flex items. The other two are flex-grow and flex-shrink. Together, these properties form what is called the "flex factor," which determines how available space is distributed among the flex items.&lt;/p&gt;

&lt;p&gt;Here’s an example of how all three properties work together:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.item {
  flex-basis: 150px;
  flex-grow: 1;
  flex-shrink: 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;In this example, the flex-basis property sets the initial size of the item to 150px. The flex-grow property is set to 1, which means that the item will grow proportionally to other flex items in the container when there is available space. The flex-shrink property is set to 0, which means that the item will not shrink when there is not enough space in the container.&lt;/p&gt;
&lt;h2&gt;
  
  
  flex-shrink
&lt;/h2&gt;

&lt;p&gt;The flex-shrink property is used to specify how much a flex item should shrink relative to the other flex items in the container when there isn't enough space on the main axis. The default value for flex-shrink is 1, which means that all flex items will shrink equally.&lt;/p&gt;

&lt;p&gt;Here’s an example that shows how flex-shrink works:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="container"&amp;gt;
  &amp;lt;div class="box box1"&amp;gt;Box 1&amp;lt;/div&amp;gt;
  &amp;lt;div class="box box2"&amp;gt;Box 2&amp;lt;/div&amp;gt;
  &amp;lt;div class="box box3"&amp;gt;Box 3&amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;

.container {
  display: flex;
}

.box {
  flex-basis: 100px;
  height: 100px;
  border: 1px solid black;
}

.box1 {
  flex-grow: 1;
  flex-shrink: 1;
}

.box2 {
  flex-grow: 1;
  flex-shrink: 2;
}

.box3 {
  flex-grow: 1;
  flex-shrink: 3;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;In this example, we have a container with three flex items. Each item has a flex-basis of 100px, which sets the initial size of the items. The flex-grow property is set to 1 for all items, which means that they will all grow equally if there is extra space on the main axis.&lt;/p&gt;

&lt;p&gt;However, the flex-shrink property is set to different values for each item. The first item has a flex-shrink value of 1, which means that it will shrink proportionally to the other items if there isn't enough space. The second item has a flex-shrink value of 2, which means that it will shrink twice as much as the first item. The third item has a flex-shrink value of 3, which means that it will shrink three times as much as the first item.&lt;/p&gt;

&lt;p&gt;If the container doesn’t have enough space to fit all the items at their initial size, the items with higher flex-shrink values will shrink more than the items with lower values. For example, if the container is only 250px wide, the first item will keep its initial size of 100px, the second item will shrink to 75px, and the third item will shrink to 50px.&lt;/p&gt;
&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, CSS Flexbox is a powerful tool for building responsive layouts with ease. It provides a simple and intuitive way to arrange elements on a web page, with a minimum amount of code. From the basics to the advanced concepts, we have covered all the important aspects of Flexbox layout in this blog.&lt;/p&gt;

&lt;p&gt;We have learned how to create a Flexbox container, how to set up Flexbox properties on child elements, and how to use Flexbox to create responsive layouts. We have also explored some of the lesser-known Flexbox properties like gap, flex-basis, and order.&lt;/p&gt;

&lt;p&gt;In summary, CSS Flexbox is a must-learn skill for any web developer. It is an efficient and modern way of creating responsive layouts, and can save you time and effort in the long run. So go ahead, give it a try and start building beautiful, responsive layouts today!&lt;/p&gt;
&lt;h3&gt;
  
  
  Thank you for reading this far
&lt;/h3&gt;

&lt;p&gt;Subscribe to my &lt;a href="https://sarveshh.beehiiv.com/"&gt;Newsletter&lt;/a&gt; for exciting posts just like this.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--1lRvgrS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/thumbnail/f1a9ebb4-72fd-41d3-820c-2caf612807b9/landscape_Untitled_design.png" height="462" class="m-0" width="880"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" rel="noopener noreferrer" class="c-link"&gt;
          Subscribe | The Pen, Pixel &amp;amp; Profit Club
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Join 1,187+ coders, entrepreneurs, and creators for a weekly newsletter featuring web dev tips, business case studies, how-to stories, writing deconstructions, and genius AI tools with usage instructions. Get inspiration and practical advice for your projects. Sign up now!
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BoOcTEVH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/logo/f1a9ebb4-72fd-41d3-820c-2caf612807b9/thumb_Untitled_design__1_.png" width="200" height="200"&gt;
        sarveshh.beehiiv.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>css</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>8 Essential CSS Tricks and Techniques for Perfecting Your Website</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Sat, 18 Feb 2023 10:38:07 +0000</pubDate>
      <link>https://dev.to/sarveshh/8-essential-css-tricks-and-techniques-for-perfecting-your-website-le</link>
      <guid>https://dev.to/sarveshh/8-essential-css-tricks-and-techniques-for-perfecting-your-website-le</guid>
      <description>&lt;h2&gt;
  
  
  8 Essential CSS Tricks and Techniques for Perfecting Your Website
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ovxbb9MU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2400/0%2A6Ks0W7zWmwZW2wj8" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ovxbb9MU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2400/0%2A6Ks0W7zWmwZW2wj8" alt="Css3" width="880" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;CSS is one of the key technologies used in web development. It allows developers to style their websites and create engaging, visually appealing interfaces. However, with so many different CSS techniques and tricks available, it can be challenging to keep up with the latest best practices.&lt;/p&gt;

&lt;p&gt;In this post, I’ll share some of the top CSS tricks and techniques that you can use to take your website’s styles to the next level.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Flexbox for Efficient Layouts&lt;/strong&gt;&lt;br&gt;
Flexbox is a powerful layout tool that allows developers to create responsive, flexible layouts quickly and easily. By using Flexbox, you can eliminate the need for complex floats and positioning, which can make your code easier to read and maintain. With Flexbox, you can create complex, multi-column layouts that adjust automatically to different screen sizes and devices.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Embrace CSS Grid for Even More Control&lt;/strong&gt;&lt;br&gt;
If you need even more control over your layouts, CSS Grid is another powerful tool to consider. CSS Grid allows you to create complex, multi-dimensional layouts that can be customized down to the individual grid cell. With CSS Grid, you can create layouts that are completely flexible and responsive, while still retaining precise control over the positioning and sizing of your elements.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Variables for Consistency and Efficiency&lt;/strong&gt;&lt;br&gt;
CSS variables are a relatively new feature in CSS, but they can be incredibly powerful. With variables, you can define reusable values for colors, font sizes, and other CSS properties, which can make your code more efficient and consistent. By using variables, you can change the appearance of your website quickly and easily, without having to manually update dozens of different styles.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Experiment with CSS Blend Modes&lt;/strong&gt;&lt;br&gt;
CSS blend modes allow you to blend two or more elements together, creating unique visual effects that can be incredibly engaging. By using blend modes, you can create cool effects like color overlays, gradients, and more. Experiment with different blend modes to find the one that works best for your website’s style.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use CSS Animations and Transitions for Dynamic Effects&lt;/strong&gt;&lt;br&gt;
Animations and transitions can bring your website to life, creating engaging and dynamic interfaces that capture users’ attention. With CSS animations and transitions, you can create effects like fading, sliding, and rotating elements, which can make your website feel more interactive and engaging. Just be careful not to overdo it — too many animations can be distracting and overwhelming.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Pseudo-Classes to Target Specific Elements&lt;/strong&gt;&lt;br&gt;
Pseudo-classes allow you to target specific elements in your HTML, based on their state or position in the document. For example, you can use the :hover pseudo-class to change the appearance of an element when the user hovers over it. Similarly, the :nth-child() pseudo-class allows you to target specific child elements of a parent element, based on their position in the HTML.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Optimize Your Styles for Performance&lt;/strong&gt;&lt;br&gt;
While CSS can be incredibly powerful, it can also have a significant impact on your website’s performance. To ensure that your website loads quickly and smoothly, it’s important to optimize your styles by using techniques like minification, compression, and caching. You can also reduce the amount of CSS your website uses by removing unused styles and consolidating multiple styles into a single rule.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use Browser DevTools for Debugging and Testing&lt;/strong&gt;&lt;br&gt;
Browser DevTools are a powerful tool for debugging and testing your CSS code. With DevTools, you can inspect and modify your website’s styles in real time, making it easy to pinpoint and fix issues. DevTools can also help you test your website’s responsiveness and accessibility, by allowing you to simulate different screen sizes and user scenarios.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Resources&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://flexboxfroggy.com/"&gt;&lt;strong&gt;Flexbox Froggy&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://blog.sarveshpatil.com/mastering-css-flexbox-from-basics-to-advanced-techniques"&gt;&lt;strong&gt;Mastering CSS Flexbox: From Basics to Advanced Techniques&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;These are just a few of the many CSS tricks and techniques that you can use to take your website’s styles to the next level. By using tools like Flexbox, CSS Grid, variables, blend modes, and animations, you can create engaging and dynamic interfaces that capture users’ attention and keep them coming back for more. So go forth and experiment — the possibilities are endless!&lt;/p&gt;
&lt;h3&gt;
  
  
  Thank you for reading this far
&lt;/h3&gt;

&lt;p&gt;Subscribe to my &lt;a href="https://sarveshh.beehiiv.com/"&gt;Newsletter&lt;/a&gt; for exciting posts just like this.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--1lRvgrS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/thumbnail/f1a9ebb4-72fd-41d3-820c-2caf612807b9/landscape_Untitled_design.png" height="462" class="m-0" width="880"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" rel="noopener noreferrer" class="c-link"&gt;
          Subscribe | The Pen, Pixel &amp;amp; Profit Club
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Join 1,187+ coders, entrepreneurs, and creators for a weekly newsletter featuring web dev tips, business case studies, how-to stories, writing deconstructions, and genius AI tools with usage instructions. Get inspiration and practical advice for your projects. Sign up now!
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BoOcTEVH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/logo/f1a9ebb4-72fd-41d3-820c-2caf612807b9/thumb_Untitled_design__1_.png" width="200" height="200"&gt;
        sarveshh.beehiiv.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://blog.sarveshpatil.com/css-tricks-tips-and-techniques-for-perfecting-your-styles"&gt;https://blog.sarveshpatil.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>css3</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Useful GitHub repositories for learning Web Development</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Wed, 17 Feb 2021 16:54:11 +0000</pubDate>
      <link>https://dev.to/sarveshh/useful-github-repositories-for-learning-web-development-ge8</link>
      <guid>https://dev.to/sarveshh/useful-github-repositories-for-learning-web-development-ge8</guid>
      <description>&lt;p&gt;I know this is kind of clickbait stuff, but I personally feel that I would've benefitted a lot if I knew this sooner. So here I go.&lt;br&gt;
You can't master something without practicing it. So, I would divide this post into some important sections such as &lt;/p&gt;
&lt;h2&gt;
  
  
  Table Of Contents
&lt;/h2&gt;

&lt;p&gt;Learning&lt;br&gt;
Practicing&lt;br&gt;
Preparing for Interviews&lt;/p&gt;
&lt;h1&gt;
  
  
  Learning &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;
&lt;h3&gt;
  
  
  1. &lt;a href="https://github.com/microsoft/Web-Dev-For-Beginners#lessons"&gt;Web Dev for Beginners&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;This has everything to get you started. Starting from the ground up, text-editors, GitHub, and whatnot.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/microsoft"&gt;
        microsoft
      &lt;/a&gt; / &lt;a href="https://github.com/microsoft/Web-Dev-For-Beginners"&gt;
        Web-Dev-For-Beginners
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      24 Lessons, 12 Weeks, Get Started as a Web Developer
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  2. &lt;a href="https://github.com/l-hammer/You-need-to-know-css#view-online"&gt;You-need-to-know-css&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Exactly, you need to know CSS. &lt;a href="https://lhammer.cn/You-need-to-know-css/#/"&gt;Here&lt;/a&gt; is a more user-friendly interface to help you learn easily.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/l-hammer"&gt;
        l-hammer
      &lt;/a&gt; / &lt;a href="https://github.com/l-hammer/You-need-to-know-css"&gt;
        You-need-to-know-css
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      💄CSS tricks for web developers~
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  3. &lt;a href="https://github.com/thedaviddias/Front-End-Checklist#table-of-contents"&gt; Front-End Checklist &lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;This is the end to the repetitive basics, but you're gonna get better because of that. Just make sure you cover everything in here.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/thedaviddias"&gt;
        thedaviddias
      &lt;/a&gt; / &lt;a href="https://github.com/thedaviddias/Front-End-Checklist"&gt;
        Front-End-Checklist
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      🗂 The perfect Front-End Checklist for modern websites and meticulous developers
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  4. &lt;a href="https://github.com/TheAlgorithms/Javascript/blob/master/DIRECTORY.md"&gt;The Algorithms - JavaScript&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Every important algorithm in Javascript exists here. Get some hold over the basics of the language and this would be easy peasy for you.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/TheAlgorithms"&gt;
        TheAlgorithms
      &lt;/a&gt; / &lt;a href="https://github.com/TheAlgorithms/JavaScript"&gt;
        JavaScript
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Algorithms and Data Structures implemented in JavaScript for beginners, following best practices.
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  5. &lt;a href="https://github.com/trekhleb/javascript-algorithms#javascript-algorithms-and-data-structures"&gt;Javascript Algorithms&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Can be used as an extension to the repository above.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/trekhleb"&gt;
        trekhleb
      &lt;/a&gt; / &lt;a href="https://github.com/trekhleb/javascript-algorithms"&gt;
        javascript-algorithms
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  6. &lt;a href="https://github.com/goldbergyoni/nodebestpractices#welcome-3-things-you-ought-to-know-first"&gt;Node.js Best Practices&lt;/a&gt; (Optional but important)
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Before we start applying our knowledge and developing projects, we need to know the best practices, and this repository will help you with that. &lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/goldbergyoni"&gt;
        goldbergyoni
      &lt;/a&gt; / &lt;a href="https://github.com/goldbergyoni/nodebestpractices"&gt;
        nodebestpractices
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      ✅  The Node.js best practices list (March 2023)
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  7. &lt;a href="https://github.com/elsewhencode/project-guidelines#project-guidelines--"&gt;Project Guidelines&lt;/a&gt; (Optional but important)
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;It never hurts to know general practices in the field, does it.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/elsewhencode"&gt;
        elsewhencode
      &lt;/a&gt; / &lt;a href="https://github.com/elsewhencode/project-guidelines"&gt;
        project-guidelines
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A set of best practices for JavaScript projects
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Practicing &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;h3&gt;
  
  
  8. &lt;a href="https://github.com/bradtraversy/vanillawebprojects#20-web-projects-with-vanilla-javascript"&gt;Vanilla Web Projects&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Okay, it's time we start making personal projects to test our knowledge. This would kickstart you just fine with HTML, CSS and Javascript.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/bradtraversy"&gt;
        bradtraversy
      &lt;/a&gt; / &lt;a href="https://github.com/bradtraversy/vanillawebprojects"&gt;
        vanillawebprojects
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Mini projects built with HTML5, CSS &amp;amp; JavaScript. No frameworks or libraries
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  9. &lt;a href="https://github.com/bradtraversy/50projects50days#50-projects-in-50-days---htmlcss-and-javascript"&gt;50projects50days&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Just in case above projects seem a tad short.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/bradtraversy"&gt;
        bradtraversy
      &lt;/a&gt; / &lt;a href="https://github.com/bradtraversy/50projects50days"&gt;
        50projects50days
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      50+ mini web projects using HTML, CSS &amp;amp; JS
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  10. &lt;a href="https://github.com/goldbergyoni/javascript-testing-best-practices#-why-this-guide-can-take-your-testing-skills-to-the-next-level"&gt;javascript-testing-best-practices&lt;/a&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Well, we all like bug-free software don't we? Testing is the phase that will make your app &lt;em&gt;almost&lt;/em&gt; bug-free.&lt;/p&gt;
&lt;/blockquote&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/goldbergyoni"&gt;
        goldbergyoni
      &lt;/a&gt; / &lt;a href="https://github.com/goldbergyoni/javascript-testing-best-practices"&gt;
        javascript-testing-best-practices
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      📗🌐 🚢 Comprehensive and exhaustive JavaScript &amp;amp; Node.js testing best practices (December 2022)
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h1&gt;
  
  
  Interviewing &lt;a&gt;&lt;/a&gt;
&lt;/h1&gt;

&lt;h3&gt;
  
  
  11. &lt;a href="https://github.com/yangshun/front-end-interview-handbook#table-of-contents"&gt;Front End Interview Handbook&lt;/a&gt;
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/yangshun"&gt;
        yangshun
      &lt;/a&gt; / &lt;a href="https://github.com/yangshun/front-end-interview-handbook"&gt;
        front-end-interview-handbook
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      ⚡️ Front End interview preparation materials for busy engineers
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  12. &lt;a href="https://github.com/lydiahallie/javascript-questions#javascript-questions"&gt;JavaScript Questions&lt;/a&gt;
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--566lAguM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/lydiahallie"&gt;
        lydiahallie
      &lt;/a&gt; / &lt;a href="https://github.com/lydiahallie/javascript-questions"&gt;
        javascript-questions
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A long list of (advanced) JavaScript questions, and their explanations ✨  
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Thank you for reading this far
&lt;/h3&gt;

&lt;p&gt;Subscribe to my &lt;a href="https://sarveshh.beehiiv.com/"&gt;Newsletter&lt;/a&gt; for exciting posts just like this.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--1lRvgrS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/thumbnail/f1a9ebb4-72fd-41d3-820c-2caf612807b9/landscape_Untitled_design.png" height="462" class="m-0" width="880"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" rel="noopener noreferrer" class="c-link"&gt;
          Subscribe | The Pen, Pixel &amp;amp; Profit Club
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Join 1,187+ coders, entrepreneurs, and creators for a weekly newsletter featuring web dev tips, business case studies, how-to stories, writing deconstructions, and genius AI tools with usage instructions. Get inspiration and practical advice for your projects. Sign up now!
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BoOcTEVH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/logo/f1a9ebb4-72fd-41d3-820c-2caf612807b9/thumb_Untitled_design__1_.png" width="200" height="200"&gt;
        sarveshh.beehiiv.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


</description>
      <category>todayilearned</category>
      <category>todayisearched</category>
      <category>javascript</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Reasons to use Next.js instead of create-react-app in your next project</title>
      <dc:creator>Sarvesh Patil</dc:creator>
      <pubDate>Tue, 17 Nov 2020 06:43:16 +0000</pubDate>
      <link>https://dev.to/sarveshh/reasons-to-use-next-js-instead-of-react-in-your-next-project-2n7k</link>
      <guid>https://dev.to/sarveshh/reasons-to-use-next-js-instead-of-react-in-your-next-project-2n7k</guid>
      <description>&lt;p&gt;React is a wonderful framework, isn't it?&lt;br&gt;
I have been a react developer for some time now and I love it.&lt;br&gt;
But recently I came across &lt;a href="https://nextjs.org/"&gt;Next.js&lt;/a&gt;, which is built on top of &lt;a href="https://reactjs.org/"&gt;React&lt;/a&gt; and it is definitely an improvement over the latter.&lt;/p&gt;
&lt;h1&gt;
  
  
  So what is Next.Js?
&lt;/h1&gt;

&lt;p&gt;NextJS is a &lt;a href="https://github.com/vercel/next.js/"&gt;open-source&lt;/a&gt; framework for building React applications. It comes with server-side rendering, static-site generation, serverless functions, SEO support and so so much more, that too out of the box. Yay!&lt;/p&gt;
&lt;h3&gt;
  
  
  How is server-side rendering faster than client-side rendering?
&lt;/h3&gt;

&lt;p&gt;In server-side rendering the contents of the webpage, be it HTML, CSS or Javascript are generated on the server, and the whole HTML page is downloaded and displayed. So, all the pre-processing, calculations, and any complex communication with the server are handled in the server itself whereas, in client-side rendering, everything is processed at clientside&lt;/p&gt;
&lt;h1&gt;
  
  
  Advantages of NextJs over React
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;It's super fast&lt;/strong&gt;&lt;br&gt;
With the help of Server-side rendering and static-site generation loads the site blazing fast.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;It's SEO friendly.&lt;/strong&gt;&lt;br&gt;
Server-side rendering fuels our goals to achieve levels of SEO, UX, performance, etc. Moreover, you can customize your own &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; tags to improve your Search Engine Optimisation to your liking by importing Head from &lt;code&gt;"next/head"&lt;/code&gt; and these meta tags will be appended to your page so that search engines could crawl swiftly. How cool is that!&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Wide features out of the box&lt;/strong&gt;&lt;br&gt;
Minifying javascript, doing code splitting, lazy loading, prefetching assets, render the minimal amount of HTML, caching builds, all performance optimization comes out of the box, in nextJs so your primary focus remains the development of your project.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h1&gt;
  
  
  How to get started?
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://nextjs.org/docs/getting-started"&gt;NextJs Docs&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  1. Pre-requisites
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/facebook/react"&gt;ReactJS&lt;/a&gt; knowledge is &lt;strong&gt;must&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nodejs.org/en/download/"&gt;NodeJS&lt;/a&gt; or &lt;a href="https://classic.yarnpkg.com/en/docs/install"&gt;Yarn&lt;/a&gt; should be installed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  2. Creating a project
&lt;/h3&gt;

&lt;p&gt;NextJS recommends creating a new Next.js app using &lt;code&gt;create-next-app&lt;/code&gt;, which sets up everything automatically for you. To create a project, run in the terminal after navigating to the desired directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-next-app
# or
yarn create next-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Here's a &lt;a href="https://codesandbox.io/s/create-next-app-example-nlxbb?from-embed=&amp;amp;file=/pages/index.js"&gt;Codesandbox example&lt;/a&gt; of what you'll get:&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/nlxbb"&gt;
&lt;/iframe&gt;
&lt;/p&gt;
&lt;h1&gt;
  
  
  Resources
&lt;/h1&gt;

&lt;blockquote&gt;
&lt;p&gt;In case you don't know ReactJS, I suggest you learn that first. There's plenty of resources available online, I will mention some of them down here.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  ReactJs resources.
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://reactjs.org/docs/getting-started.html"&gt;ReactJS Official Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://youtu.be/Ke90Tje7VS0"&gt;ReactJS YouTube crash course&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  NextJS resources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/docs/getting-started"&gt;NextJs Docs&lt;/a&gt; is great place to start.&lt;/li&gt;
&lt;li&gt;This &lt;a href="https://youtu.be/tt3PUvhOVzo"&gt;YouTube course&lt;/a&gt; will get you started from ground up.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Thank you for reading this far
&lt;/h3&gt;

&lt;p&gt;Subscribe to my &lt;a href="https://sarveshh.beehiiv.com/"&gt;Newsletter&lt;/a&gt; for exciting posts just like this.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
      &lt;div class="c-embed__cover"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" class="c-link s:max-w-50 align-middle" rel="noopener noreferrer"&gt;
          &lt;img alt="" src="https://res.cloudinary.com/practicaldev/image/fetch/s--1lRvgrS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/thumbnail/f1a9ebb4-72fd-41d3-820c-2caf612807b9/landscape_Untitled_design.png" height="462" class="m-0" width="880"&gt;
        &lt;/a&gt;
      &lt;/div&gt;
    &lt;div class="c-embed__body"&gt;
      &lt;h2 class="fs-xl lh-tight"&gt;
        &lt;a href="https://sarveshh.beehiiv.com/subscribe" rel="noopener noreferrer" class="c-link"&gt;
          Subscribe | The Pen, Pixel &amp;amp; Profit Club
        &lt;/a&gt;
      &lt;/h2&gt;
        &lt;p class="truncate-at-3"&gt;
          Join 1,187+ coders, entrepreneurs, and creators for a weekly newsletter featuring web dev tips, business case studies, how-to stories, writing deconstructions, and genius AI tools with usage instructions. Get inspiration and practical advice for your projects. Sign up now!
        &lt;/p&gt;
      &lt;div class="color-secondary fs-s flex items-center"&gt;
          &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://res.cloudinary.com/practicaldev/image/fetch/s--BoOcTEVH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media.beehiiv.com/cdn-cgi/image/fit%3Dscale-down%2Cformat%3Dauto%2Conerror%3Dredirect%2Cquality%3D80/uploads/publication/logo/f1a9ebb4-72fd-41d3-820c-2caf612807b9/thumb_Untitled_design__1_.png" width="200" height="200"&gt;
        sarveshh.beehiiv.com
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



</description>
      <category>react</category>
      <category>javascript</category>
      <category>news</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
