<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ReactWithShubham]]></title><description><![CDATA[ReactWithShubham]]></description><link>https://reactwithshubhamandchai.hashnode.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1593680282896/kNC7E8IR4.png</url><title>ReactWithShubham</title><link>https://reactwithshubhamandchai.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 01 Sep 2026 03:54:08 GMT</lastBuildDate><atom:link href="https://reactwithshubhamandchai.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Expo Router vs React Navigatio]]></title><description><![CDATA[React Native navigation has changed a lot over the years.
A few years ago, setting up navigation in a React Native app meant manually creating stacks, linking screens, managing nested navigators, hand]]></description><link>https://reactwithshubhamandchai.hashnode.dev/expo-router-vs-react-navigatio</link><guid isPermaLink="true">https://reactwithshubhamandchai.hashnode.dev/expo-router-vs-react-navigatio</guid><dc:creator><![CDATA[Shubham Bhardwaj]]></dc:creator><pubDate>Sat, 23 May 2026 05:02:23 GMT</pubDate><content:encoded><![CDATA[<p>React Native navigation has changed a lot over the years.</p>
<p>A few years ago, setting up navigation in a React Native app meant manually creating stacks, linking screens, managing nested navigators, handling authentication flow logic, and maintaining large navigation files that became harder to scale over time.</p>
<p>Today, developers have two major approaches:</p>
<p>- **React Navigation** — the long-time industry standard</p>
<p>- **Expo Router** — the newer file-based routing solution built on top of React Navigation</p>
<p>Both are powerful. Both are widely used. But they solve developer problems in very different ways.</p>
<p>In this article, we’ll understand:</p>
<p>- What routing actually means in mobile apps</p>
<p>- Why navigation matters so much</p>
<p>- Problems with traditional navigation setups</p>
<p>- How Expo Router changes the developer workflow</p>
<p>- Performance and scalability comparisons</p>
<p>- When to use each approach</p>
<p>- And when NOT to use Expo Router</p>
<p>This is not a “winner vs loser” comparison.</p>
<p>The goal is to understand the mental model behind both systems so you can choose the right tool for your application in 2026.</p>
<p>---</p>
<p># What Does Routing Mean in Mobile Applications?</p>
<p>Routing simply means:</p>
<p>&gt; Moving between screens while maintaining application state.</p>
<p>For example:</p>
<p>- Home → Product Screen</p>
<p>- Login → Dashboard</p>
<p>- Feed → Profile → Settings</p>
<p>- Cart → Checkout → Payment</p>
<p>In mobile applications, routing is more complex than websites because apps maintain:</p>
<p>- Navigation stacks</p>
<p>- Gesture handling</p>
<p>- Screen history</p>
<p>- Animations</p>
<p>- State persistence</p>
<p>- Deep linking</p>
<p>- Authentication flow</p>
<p>Unlike traditional websites where pages reload, React Native apps keep screens alive in memory and transition between them smoothly.</p>
<p>That is why navigation architecture becomes extremely important in large applications.</p>
<p>---</p>
<p># Why Navigation Is Important in React Native Apps</p>
<p>Navigation is not just about changing screens.</p>
<p>It controls:</p>
<p>- User experience</p>
<p>- App structure</p>
<p>- State flow</p>
<p>- Authentication behavior</p>
<p>- Performance</p>
<p>- Scalability</p>
<p>- Developer productivity</p>
<p>A badly structured navigation system eventually creates problems like:</p>
<p>- Huge navigation files</p>
<p>- Confusing nested navigators</p>
<p>- Repeated boilerplate</p>
<p>- Difficult debugging</p>
<p>- Broken deep links</p>
<p>- Complex authentication handling</p>
<p>As applications grow, navigation becomes part of the application architecture itself.</p>
<p>---</p>
<p># Brief History of React Navigation</p>
<p>In the early React Native ecosystem, navigation was painful.</p>
<p>Developers used libraries like:</p>
<p>- NavigatorIOS</p>
<p>- ExNavigator</p>
<p>- react-native-router-flux</p>
<p>Most solutions were unstable or platform-specific.</p>
<p>Then came **React Navigation**.</p>
<p>It became the standard solution because it provided:</p>
<p>- Stack navigation</p>
<p>- Bottom tabs</p>
<p>- Drawer navigation</p>
<p>- Nested navigators</p>
<p>- Deep linking support</p>
<p>- Transition animations</p>
<p>- Gesture support</p>
<p>Over time, React Navigation matured into one of the most widely adopted libraries in React Native development.</p>
<p>Even today, most production React Native apps still use it internally.</p>
<p>---</p>
<p># Problems Developers Faced With Traditional Navigation Setup</p>
<p>React Navigation is powerful, but large projects often become difficult to manage.</p>
<p>A common setup looked like this:</p>
<p>```txt</p>
<p>navigation/</p>
<p>├── AppNavigator.js</p>
<p>├── AuthNavigator.js</p>
<p>├── BottomTabs.js</p>
<p>├── DashboardStack.js</p>
<p>└── SettingsStack.js</p>
<p>```</p>
<p>Inside those files, developers manually defined:</p>
<p>- Screens</p>
<p>- Stacks</p>
<p>- Route names</p>
<p>- Nested navigators</p>
<p>- Authentication logic</p>
<p>Example:</p>
<p>```js</p>
<p>&lt;Stack.Navigator&gt;</p>
<p>&lt;Stack.Screen name="Home" component={HomeScreen} /&gt;</p>
<p>&lt;Stack.Screen name="Profile" component={ProfileScreen} /&gt;</p>
<p>&lt;/Stack.Navigator&gt;</p>
<p>```</p>
<p>This created several problems:</p>
<p>## 1. Too Much Boilerplate</p>
<p>Developers repeated route declarations everywhere.</p>
<p>## 2. Harder Scalability</p>
<p>Large apps ended up with deeply nested navigation trees.</p>
<p>## 3. Mental Overhead</p>
<p>You had to constantly remember:</p>
<p>- Route names</p>
<p>- Stack hierarchy</p>
<p>- Nested structures</p>
<p>## 4. Navigation Logic Became Centralized</p>
<p>Huge navigation files became difficult to maintain.</p>
<p>## 5. Authentication Flows Became Messy</p>
<p>Conditionally rendering stacks for auth vs app flow increased complexity.</p>
<p>---</p>
<p># Why Expo Router Was Introduced</p>
<p>Expo Router was introduced to simplify routing using a file-based routing system.</p>
<p>Instead of manually registering screens, your folders automatically become routes.</p>
<p>This idea was inspired by frameworks like:</p>
<p>- Next.js</p>
<p>- Remix</p>
<p>- Nuxt</p>
<p>Expo Router aimed to solve:</p>
<p>- Boilerplate</p>
<p>- Scaling problems</p>
<p>- Route organization</p>
<p>- Deep linking setup</p>
<p>- Layout sharing</p>
<p>- Authentication complexity</p>
<p>The biggest thing to understand is:</p>
<p>&gt; Expo Router is NOT a replacement for React Navigation internally.</p>
<p>It is actually built on top of React Navigation.</p>
<p>Expo Router simply changes the developer experience and routing mental model.</p>
<p>---</p>
<p># File-Based Routing Explained Simply</p>
<p>With Expo Router, folders and files define navigation automatically.</p>
<p>Example:</p>
<p>```txt</p>
<p>app/</p>
<p>├── index.tsx</p>
<p>├── profile.tsx</p>
<p>├── settings.tsx</p>
<p>```</p>
<p>Automatically becomes:</p>
<p>```txt</p>
<p>/ -&gt; index.tsx</p>
<p>/profile -&gt; profile.tsx</p>
<p>/settings -&gt; settings.tsx</p>
<p>```</p>
<p>You no longer manually register screens.</p>
<p>That reduces a huge amount of setup code.</p>
<p>---</p>
<p># Nested Layouts and Shared Layouts in Expo Router</p>
<p>One of Expo Router’s strongest features is layouts.</p>
<p>Example structure:</p>
<p>```txt</p>
<p>app/</p>
<p>├── _layout.tsx</p>
<p>├── (tabs)/</p>
<p>│ ├── _layout.tsx</p>
<p>│ ├── home.tsx</p>
<p>│ ├── search.tsx</p>
<p>│ └── profile.tsx</p>
<p>└── auth/</p>
<p>├── login.tsx</p>
<p>└── signup.tsx</p>
<p>```</p>
<p>This allows:</p>
<p>- Shared navigation wrappers</p>
<p>- Shared tab bars</p>
<p>- Shared headers</p>
<p>- Nested navigation automatically</p>
<p>Instead of manually nesting navigators, layouts define structure naturally.</p>
<p>This becomes extremely useful in:</p>
<p>- Dashboards</p>
<p>- Admin panels</p>
<p>- Ecommerce apps</p>
<p>- Large enterprise apps</p>
<p>---</p>
<p># Protected Routes and Authentication Flows</p>
<p>Authentication is traditionally one of the hardest parts of navigation.</p>
<p>In React Navigation:</p>
<p>```js</p>
<p>isLoggedIn ?  : </p>
<p>```</p>
<p>As apps grow, this becomes harder to manage.</p>
<p>Expo Router improves this using layouts and route groups.</p>
<p>Example:</p>
<p>```txt</p>
<p>app/</p>
<p>├── (protected)/</p>
<p>├── (public)/</p>
<p>```</p>
<p>You can protect entire sections of the application using middleware-like logic.</p>
<p>This creates cleaner auth architecture.</p>
<p>Especially for:</p>
<p>- Dashboards</p>
<p>- Subscription apps</p>
<p>- SaaS platforms</p>
<p>- Enterprise systems</p>
<p>---</p>
<p># Performance Comparison</p>
<p>Many developers think Expo Router is slower because it adds another layer.</p>
<p>But in reality:</p>
<p>&gt; Expo Router still uses React Navigation internally.</p>
<p>So actual runtime performance differences are usually very small.</p>
<p>The bigger difference is in workflow and architecture.</p>
<p>---</p>
<p># Bundle Behavior</p>
<p>## React Navigation</p>
<p>- Manual imports</p>
<p>- Manual navigator configuration</p>
<p>- More explicit control</p>
<p>## Expo Router</p>
<p>- Automatic route generation</p>
<p>- Better route organization</p>
<p>- Simplified deep linking</p>
<p>Modern bundlers handle both efficiently.</p>
<p>In real-world apps, performance differences are usually negligible.</p>
<p>---</p>
<p># Navigation Transitions</p>
<p>Since Expo Router uses React Navigation internally:</p>
<p>- Stack animations are similar</p>
<p>- Gesture handling is similar</p>
<p>- Native transitions are similar</p>
<p>The navigation engine underneath is still React Navigation.</p>
<p>---</p>
<p># Developer Workflow Comparison</p>
<p>This is where the biggest difference exists.</p>
<p>---</p>
<p># React Navigation Workflow</p>
<p>Typical workflow:</p>
<p>1. Create screen</p>
<p>2. Import screen</p>
<p>3. Register route</p>
<p>4. Update stack</p>
<p>5. Handle nesting</p>
<p>6. Configure deep linking</p>
<p>This gives more control.</p>
<p>But it also increases repetitive work.</p>
<p>---</p>
<p># Expo Router Workflow</p>
<p>Typical workflow:</p>
<p>1. Create file</p>
<p>2. Done</p>
<p>That simplicity changes developer productivity significantly.</p>
<p>Especially for beginners and fast-moving startups.</p>
<p>---</p>
<p># Developer Experience (DX) Comparison</p>
<p>## React Navigation DX</p>
<p>### Pros</p>
<p>- Extremely flexible</p>
<p>- Full manual control</p>
<p>- Mature ecosystem</p>
<p>- Better for custom architectures</p>
<p>### Cons</p>
<p>- More setup</p>
<p>- More boilerplate</p>
<p>- Harder mental model</p>
<p>- Navigation files grow quickly</p>
<p>---</p>
<p>## Expo Router DX</p>
<p>### Pros</p>
<p>- Faster development</p>
<p>- Cleaner structure</p>
<p>- Easier onboarding</p>
<p>- Excellent for scaling folders</p>
<p>- Better route organization</p>
<p>### Cons</p>
<p>- Less explicit control</p>
<p>- Requires understanding file conventions</p>
<p>- Some advanced custom flows feel restrictive</p>
<p>---</p>
<p># Scalability Comparison for Large Applications</p>
<p>This is where opinions become divided.</p>
<p>---</p>
<p># React Navigation in Large Apps</p>
<p>Large companies still prefer React Navigation because:</p>
<p>- Architecture control matters</p>
<p>- Teams want explicit navigation logic</p>
<p>- Custom behavior is easier</p>
<p>- Existing systems already use it</p>
<p>Enterprise teams often value predictability over simplicity.</p>
<p>---</p>
<p># Expo Router in Large Apps</p>
<p>Expo Router scales surprisingly well because folder structures naturally organize features.</p>
<p>Example:</p>
<p>```txt</p>
<p>app/</p>
<p>├── (tabs)/</p>
<p>├── dashboard/</p>
<p>├── analytics/</p>
<p>├── billing/</p>
<p>├── settings/</p>
<p>└── admin/</p>
<p>```</p>
<p>This makes feature separation cleaner.</p>
<p>For many modern startups, Expo Router feels more maintainable.</p>
<p>Especially with smaller teams.</p>
<p>---</p>
<p># Real-World Folder Structure Examples</p>
<p>---</p>
<p># React Navigation Structure</p>
<p>```txt</p>
<p>src/</p>
<p>├── navigation/</p>
<p>│ ├── RootNavigator.tsx</p>
<p>│ ├── AuthNavigator.tsx</p>
<p>│ ├── TabNavigator.tsx</p>
<p>│ └── DashboardNavigator.tsx</p>
<p>│</p>
<p>├── screens/</p>
<p>├── components/</p>
<p>└── services/</p>
<p>```</p>
<p>---</p>
<p># Expo Router Structure</p>
<p>```txt</p>
<p>app/</p>
<p>├── _layout.tsx</p>
<p>├── (tabs)/</p>
<p>│ ├── _layout.tsx</p>
<p>│ ├── home.tsx</p>
<p>│ ├── search.tsx</p>
<p>│ └── profile.tsx</p>
<p>│</p>
<p>├── auth/</p>
<p>│ ├── login.tsx</p>
<p>│ └── signup.tsx</p>
<p>│</p>
<p>├── dashboard/</p>
<p>├── settings/</p>
<p>└── admin/</p>
<p>```</p>
<p>Expo Router usually feels more aligned with how developers mentally visualize applications.</p>
<p>---</p>
<p># Which Approach Do Companies Prefer?</p>
<p>The answer depends on team size and project history.</p>
<p>## Many Existing Companies Still Use React Navigation</p>
<p>Because:</p>
<p>- Legacy apps already depend on it</p>
<p>- Teams need deep customization</p>
<p>- Migration costs are high</p>
<p>- Senior engineers prefer explicit architecture</p>
<p>---</p>
<p>## Startups and New Expo Apps Prefer Expo Router</p>
<p>Because:</p>
<p>- Faster setup</p>
<p>- Faster onboarding</p>
<p>- Cleaner project structure</p>
<p>- Easier scaling for smaller teams</p>
<p>Expo Router adoption has grown rapidly in the Expo ecosystem.</p>
<p>Especially among developers building modern apps quickly.</p>
<p>---</p>
<p># When NOT to Use Expo Router</p>
<p>Expo Router is not automatically the best choice for every application.</p>
<p>Avoid it when:</p>
<p>- Your team already has complex React Navigation architecture</p>
<p>- You need extremely custom navigation behavior</p>
<p>- You want total navigation control</p>
<p>- Your app uses heavily dynamic route generation</p>
<p>- Your developers dislike convention-based systems</p>
<p>Some engineers simply prefer explicit configuration over file conventions.</p>
<p>That is completely valid.</p>
<p>---</p>
<p># Situations Where React Navigation Still Makes More Sense</p>
<p>React Navigation is still excellent for:</p>
<p>- Enterprise applications</p>
<p>- Existing production apps</p>
<p>- Highly customized navigation systems</p>
<p>- Complex nested flows</p>
<p>- Teams wanting full manual control</p>
<p>It is still one of the best navigation libraries in React Native.</p>
<p>Expo Router does not replace its importance.</p>
<p>In fact:</p>
<p>&gt; Expo Router depends on React Navigation internally.</p>
<p>---</p>
<p># Beginner Perspective</p>
<p>For beginners:</p>
<p>## Expo Router Usually Feels Easier</p>
<p>Because:</p>
<p>- Less boilerplate</p>
<p>- Easier mental model</p>
<p>- Faster learning curve</p>
<p>- Folder-based thinking feels natural</p>
<p>You focus more on building screens rather than wiring navigation.</p>
<p>---</p>
<p># Team Scalability Perspective</p>
<p>For growing teams:</p>
<p>## Expo Router Helps With Organization</p>
<p>Feature folders naturally separate application sections.</p>
<p>This improves:</p>
<p>- Collaboration</p>
<p>- Onboarding</p>
<p>- Code discoverability</p>
<p>Especially in startup environments.</p>
<p>---</p>
<p># Enterprise Maintainability Perspective</p>
<p>Large enterprises often still prefer React Navigation because:</p>
<p>- Explicit architecture scales predictably</p>
<p>- Navigation behavior is easier to audit</p>
<p>- Advanced customization is simpler</p>
<p>- Teams already have established patterns</p>
<p>Convention-based systems sometimes become restrictive at enterprise scale.</p>
<p>---</p>
<p># Final Verdict — Which One Should You Use in 2026?</p>
<p>There is no universal winner.</p>
<p>The better choice depends on:</p>
<p>- Team size</p>
<p>- App complexity</p>
<p>- Architecture preferences</p>
<p>- Development speed requirements</p>
<p>---</p>
<p># Choose Expo Router If:</p>
<p>- You are starting a new Expo project</p>
<p>- You want faster development</p>
<p>- You prefer file-based routing</p>
<p>- You want cleaner folder organization</p>
<p>- Your team values developer experience</p>
<p>---</p>
<p># Choose React Navigation If:</p>
<p>- You need full navigation control</p>
<p>- Your app already uses React Navigation</p>
<p>- You are building highly customized flows</p>
<p>- Your team prefers explicit architecture</p>
<p>- You work on enterprise-scale systems</p>
<p>---</p>
<p># Conclusion</p>
<p>React Navigation defined React Native navigation for years.</p>
<p>Expo Router is redefining how developers think about routing by simplifying workflows and reducing boilerplate.</p>
<p>But the most important thing to remember is:</p>
<p>&gt; Expo Router is built on top of React Navigation, not separate from it.</p>
<p>This is not a battle between “old vs new.”</p>
<p>It is really a choice between:</p>
<p>- Explicit configuration</p>
<p>vs</p>
<p>- Convention-based architecture</p>
<p>In 2026, both approaches are valid.</p>
<p>The best developers are the ones who understand:</p>
<p>- The mental model</p>
<p>- The tradeoffs</p>
<p>- The workflow differences</p>
<p>And choose the right tool based on the project — not hype.</p>
]]></content:encoded></item><item><title><![CDATA[How React Virtual DOM works under the Hood]]></title><description><![CDATA[Virtual DOM the name is famous in the react work let's see the working of the virtual DOM step by step


What problem the Virtual DOM solves
Life without virtual DOM is little easy whenever we need an]]></description><link>https://reactwithshubhamandchai.hashnode.dev/how-react-virtual-dom-works-under-the-hood</link><guid isPermaLink="true">https://reactwithshubhamandchai.hashnode.dev/how-react-virtual-dom-works-under-the-hood</guid><dc:creator><![CDATA[Shubham Bhardwaj]]></dc:creator><pubDate>Sat, 09 May 2026 02:32:29 GMT</pubDate><content:encoded><![CDATA[<p>Virtual DOM the name is famous in the react work let's see the working of the virtual DOM step by step</p>
<img src="https://cdn.hashnode.com/uploads/covers/67e41ba26be2bc2400a699ee/bb1161ad-2884-4c74-bd02-505a558c0c43.png" alt="" style="display:block;margin:0 auto" />

<h3>What problem the Virtual DOM solves</h3>
<p>Life without virtual DOM is little easy whenever we need any change to happen we select the element and then update that <code>document.getElementById('item1').textContent = 'New';</code> ya looks easy until you don't realize that when an element is update browser do the two tasks <strong>Reflow and Repaint.</strong></p>
<p>When you change the DOM, the browser must:</p>
<ol>
<li><p><strong>Reflow</strong> (layout recalculation): Recalculate the position and size of every affected element.</p>
</li>
<li><p><strong>Repaint</strong>: Redraw pixels to the screen based on the new layout.</p>
</li>
</ol>
<p>This causes the very expensive operations each update can take milliseconds—which sounds tiny, but compounds quickly.<br />Think like that you make the 50 DOM changes, you trigger 50 reflows and 50 repaints. Now multiply that across millions of concurrent users, and your website crawls.<br />This is the problem that <strong>Virtual DOM is solving.</strong></p>
<p><strong>Virtual DOM</strong> is just nothing making a DOM tree before sending to the client side this is in the memory. Whenever any changes happens a new virtual DOM is created and then finding the difference between old VDOM or new VDOM then calculate the minimal set of actual DOM changes needed. The changes are applied to the <strong>real DOM in the browser</strong>. Virtual DOM helps reduce unnecessary real DOM updates.<br />Virtual DOM is <strong>not</strong> “a DOM tree before sending to the client.” It is a <strong>lightweight JavaScript representation of the UI in memory</strong>.</p>
<p><img src="align=%22center%22" alt="" /></p>
<h3>Difference between Real DOM vs Virtual DOM</h3>
<ul>
<li><p>Real DOM is a complete HTML tree actually present in the browser on the other hand Virtual DOM is a JavaScript representation of the UI in memory.<br /><strong>Real DOM Direct Manipulation:</strong></p>
<pre><code class="language-javascript">// You directly touch the Real DOM
function updateProfile(name, age) {
  document.getElementById('name').textContent = name;
  // Browser: reflow + repaint
  
  document.getElementById('age').textContent = age;
  // Browser: reflow + repaint again
  
  document.getElementById('profile').style.display = 'block';
  // Browser: reflow + repaint again
  // This make the Total: 3 reflows, 3 repaints
}
</code></pre>
<pre><code class="language-javascript">// Real DOM Structure
&lt;div id="profile"&gt;
  &lt;h1 id="name"&gt;John Doe&lt;/h1&gt;
  &lt;p id="age"&gt;25&lt;/p&gt;
&lt;/div&gt;
</code></pre>
<p><strong>Virtual DOM Approach:</strong></p>
<pre><code class="language-javascript">// Virtual DOM: All changes happen in memory first
function updateProfile(name, age) {
  // Create new virtual representation
  const newVdom = {
    type: 'div', // element
    props: { id: 'profile', style: { display: 'block' } },
    children: [
      { type: 'h1', props: { id: 'name' }, children: [name] },
      { type: 'p', props: { id: 'age' }, children: [age] }
    ]
  };
  
  // Compare with old vdom (all in memory - NO reflow/repaint yet)
  const differences = diffAlgorithm(oldVdom, newVdom);
  
  // Now apply ONLY the differences to Real DOM
  // Instead of 3 separate updates, apply 1 optimized batch
  applyChangesToRealDOM(differences);
  // Only 1 reflow, 1 repaint
}
</code></pre>
</li>
<li><p>The Real DOM is memory-heavy because each element is a complex object with many properties. A single DOM node contains not just the tag name and attributes, but also computed styles, event listeners, parent references, child references, and dozens of other metadata fields. The browser needs all this information to render and manage the page properly.<br />The Virtual DOM is lightweight by design. It only stores the essential information: the element type, the props (attributes), and the children. It doesn't need computed styles, event listeners, or complex references. This makes Virtual DOM objects much smaller and faster to create and destroy. However, this comes with a trade-off: the framework must maintain both the Virtual DOM and the Real DOM in memory simultaneously, which doubles the memory usage compared to just having the Real DOM.</p>
</li>
</ul>
<h3>Initial render process in React</h3>
<p>Initial render in react is the first time when the react create the DOM and this time react make the DOM from scratch. It's different from subsequent updates because there's no previous Virtual DOM to compare against. This process start when react application start at first time or any component is mounts for the first time.</p>
]]></content:encoded></item></channel></rss>