<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vaibhav Thakur on Medium]]></title>
        <description><![CDATA[Stories by Vaibhav Thakur on Medium]]></description>
        <link>https://medium.com/@vaibhav11t?source=rss-dc43f28033f1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xJ73ZmiM-NMm1YBSdR2u2A.jpeg</url>
            <title>Stories by Vaibhav Thakur on Medium</title>
            <link>https://medium.com/@vaibhav11t?source=rss-dc43f28033f1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 12:32:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vaibhav11t/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why Your API Calls Don’t Belong in Your Components — A Zustand Store Architecture Pattern]]></title>
            <link>https://medium.com/@vaibhav11t/why-your-api-calls-dont-belong-in-your-components-a-zustand-store-architecture-pattern-61e237283b67?source=rss-dc43f28033f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/61e237283b67</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[zustand]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Vaibhav Thakur]]></dc:creator>
            <pubDate>Sat, 23 May 2026 11:52:47 GMT</pubDate>
            <atom:updated>2026-05-23T11:52:47.138Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*90WEQyu6eXNgi0y2" /><figcaption>Photo by <a href="https://unsplash.com/@nathaliarosa?utm_source=medium&amp;utm_medium=referral">Nathália Rosa</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>One of the most common habits I’ve seen (and written myself) is this: you need data, so you open the component, drop in a useEffect, fire a fetch, juggle a loading state, catch an error, and call it done. It works. It ships. And then six months later, three different components are doing the same fetch, error handling is inconsistent across the app, and testing any of it feels like defusing a bomb.</p><p>I recently came around something different. API calls lived in Zustand stores. Components just received data, loading, and error as state. It felt clean in a way that was hard to articulate at first.</p><p>This article breaks down that pattern — why it exists, how to implement it, and what it’s actually called.</p><h3>The Way Most of Us Start</h3><p>Let’s say you’re building a user profile page. The typical approach looks like this:</p><pre>const UserProfile = ({ userId }) =&gt; {<br>  const [user, setUser] = useState(null);<br>  const [loading, setLoading] = useState(false);<br>  const [error, setError] = useState(null);<br><br>  useEffect(() =&gt; {<br>      const fetchUser = async () =&gt; {<br>        setLoading(true);<br>        try {<br>          const res = await fetch(`/api/users/${userId}`);<br>          const data = await res.json();<br>          setUser(data);<br>        } catch (err) {<br>          setError(err.message);<br>        } finally {<br>          setLoading(false);<br>        }<br>      };<br>      fetchUser();<br>   }, [userId]);<br><br>   if (loading) return &lt;Spinner /&gt;;<br><br>   if (error) return &lt;ErrorMessage message={error} /&gt;;<br><br>   return &lt;div&gt;{user?.name}&lt;/div&gt;;<br>};</pre><p>This is fine for one component. But here’s what happens in the real world:</p><ul><li>A UserAvatar component in the navbar also needs the same user data — so you copy the logic</li><li>A UserSettings page needs it too — another copy</li><li>One of them handles errors differently, another forgets the loading state</li><li>You refactor the API endpoint — now you’re hunting down three files</li></ul><p>The component is doing two jobs: <strong>fetching data</strong> and <strong>rendering UI</strong>. These are different concerns, and mixing them is what creates the mess.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FnUN9-w_X_ZkD8SA9g2T7Q.png" /></figure><h3>Enter the Zustand Store Pattern</h3><p>The idea is simple: <strong>let the store own everything about the data — fetching, loading state, error state, and caching. Let the component only care about rendering.</strong></p><p>Here’s the same user profile feature, refactored:</p><pre>import { create } from &#39;zustand&#39;;<br><br>const useUserStore = create((set) =&gt; ({<br>  user: null,<br>  loading: false,<br>  error: null,<br>  fetchUser: async (userId) =&gt; {<br>    set({ loading: true, error: null });<br>    try {<br>      const res = await fetch(`/api/users/${userId}`);<br>      const data = await res.json();<br>      set({ user: data, loading: false });<br>    } catch (err) {<br>      set({ error: err.message, loading: false });<br>    }<br>  },<br>}));<br><br>export default useUserStore;</pre><p>And now the component becomes beautifully dumb:</p><pre>const UserProfile = ({ userId }) =&gt; {<br>  const { user, loading, error, fetchUser } = useUserStore();<br><br>  useEffect(() =&gt; {<br>      fetchUser(userId);<br>  }, [userId]);<br><br>  if (loading) return &lt;Spinner /&gt;;<br><br>  if (error) return &lt;ErrorMessage message={error} /&gt;;<br><br>  return &lt;div&gt;{user?.name}&lt;/div&gt;;<br>};</pre><p>The component no longer knows <em>how</em> the data is fetched. It just subscribes to state and renders. UserAvatar and UserSettings can now import the same store and get the same data — no duplication, no inconsistency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iPd7_stXZul1YT6k8XifwQ.png" /></figure><h3>What Is This Pattern Actually Called?</h3><p>When I first saw this setup, I thought it was the <strong>Flux architecture</strong> — the pattern Facebook introduced years ago. But that’s not quite right.</p><p><strong>Flux</strong> is a specific pattern with a rigid structure:</p><pre>Action -&gt; Dispatcher -&gt; Store -&gt; View</pre><p>It has a central <strong>Dispatcher</strong> as the hub. Everything flows through it. Libraries like Redux are heavily inspired by Flux.</p><p><strong>What you have with Zustand</strong> is something simpler and more modern:</p><pre>Component triggers action -&gt; Zustand Store (fetches + holds state) -&gt; Component reads state</pre><p>There’s no central dispatcher. Stores are self-contained. This is more accurately called a <strong>unidirectional data flow architecture</strong> using a <strong>store-driven pattern</strong>.</p><p>Think of the lineage like this:</p><blockquote><strong><em>Flux</em></strong><em> (2014) → </em><strong><em>Redux</em></strong><em> (stricter, more boilerplate) → </em><strong><em>MobX</em></strong><em> (reactive) → </em><strong><em>Zustand / Jotai</em></strong><em> (lightweight, modern)</em></blockquote><p>Zustand kept the best idea — <em>store as single source of truth</em> — and threw away the ceremony.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hHSIAEV4-1U8z6a75x7QoA.png" /></figure><h3>Why This Architecture Scales Well</h3><p>Once you adopt this pattern consistently, a few things become much easier:</p><p><strong>1. No duplicate fetching logic</strong> The fetch lives in one place. Any component across your app can subscribe to the same store. Update the endpoint? Change it once.</p><p><strong>2. Consistent loading and error states</strong> Because the store controls loading and error, every part of your UI that uses that store gets the same state. No more one component showing a spinner while another silently fails.</p><p><strong>3. Easier testing</strong> You can test your store logic completely independently of any component. Just call fetchUser(), mock the API, and assert on the state. No need to render anything.</p><p><strong>4. Components become predictable</strong> A component that only reads from a store and renders is much easier to reason about. It has no side effects of its own. This is sometimes called a <strong>presentational</strong> or <strong>dumb</strong> component — and they’re a joy to work with.</p><h3>When Should You Use Something Else?</h3><p>This pattern is great, but it’s not the answer to everything.</p><p><strong>Use TanStack Query (React Query) when:</strong></p><ul><li>You’re dealing with pure <strong>server state</strong> (data that lives on a server and needs to stay in sync)</li><li>You need built-in caching, background refetching, pagination, or optimistic updates</li><li>You don’t need the data shared widely across the app</li></ul><p><strong>Stick with Zustand stores for API calls when:</strong></p><ul><li>The fetched data needs to be <strong>shared across many components</strong></li><li>You’re mixing server data with <strong>client-side state</strong> in the same store</li><li>You want a simpler setup without adding another library</li></ul><p>Many mature apps actually use <strong>both</strong> — TanStack Query for data fetching and Zustand for global UI state. They solve different problems and complement each other well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2pzKkxKnJniOuw34FRlznw.png" /></figure><h3>The Mental Model to Take Away</h3><p>Here’s the simplest way to think about it:</p><blockquote><strong><em>Stores are smart. Components are dumb.</em></strong></blockquote><p>Stores know how to get data, handle failures, and manage loading. Components know how to render what they’re given. When you keep these responsibilities separate, your codebase becomes something you can actually navigate six months later.</p><p>This pattern is just disciplined. And that discipline, applied consistently, is what separates a codebase that’s a pleasure to work in from one that everyone dreads touching.</p><p><em>If you found this useful, I also wrote about </em><a href="https://medium.com/@vaibhav11t/react-clean-architecture-a-scalable-project-structure-for-real-applications-8977501b25f4"><em>React Clean Architecture</em></a><em> and </em><a href="https://medium.com/@vaibhav11t/system-design-tips-for-frontend-engineers-lessons-from-building-real-features-1adc059f0b45"><em>System Design for Frontend Engineers</em></a><em> — both follow similar ideas around structure and separation of concerns.</em></p><p><em>Follow me on </em><a href="https://www.linkedin.com/in/vaibhav-thakur-24aa38174/"><em>LinkedIn</em></a><em> and </em><a href="https://www.instagram.com/vaibhav11t/"><em>Instagram</em></a><em> for more dev insights and projects.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61e237283b67" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Clean Architecture: A Scalable Project Structure for Real Applications]]></title>
            <link>https://medium.com/@vaibhav11t/react-clean-architecture-a-scalable-project-structure-for-real-applications-8977501b25f4?source=rss-dc43f28033f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/8977501b25f4</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Vaibhav Thakur]]></dc:creator>
            <pubDate>Tue, 07 Apr 2026 09:11:56 GMT</pubDate>
            <atom:updated>2026-04-07T09:11:56.258Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q2lYwr-QFHHtPtMc" /><figcaption>Photo by <a href="https://unsplash.com/@moneyphotos?utm_source=medium&amp;utm_medium=referral">rc.xyz NFT gallery</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Most React projects don’t fail because of bad code — they fail because of bad structure.</p><p>What starts as a simple app quickly turns into a mess: scattered API calls, confusing folders, and hard-to-maintain components.</p><h3>The Core Idea</h3><p>Instead of mixing everything together, structure your app like this:</p><pre>Routes → Pages → Components → Services → API</pre><h3>Architecture Overview</h3><p>A more structured view:</p><pre>[ UI Layer ]<br>     ↓<br>[ Pages ]<br>     ↓<br>[ Components ]<br>     ↓<br>[ Services ]<br>     ↓<br>[ API ]</pre><p>This layered approach ensures:</p><ul><li>separation of concerns</li><li>better scalability</li><li>easier debugging</li></ul><h3>Project Structure</h3><pre>src/<br>  routes/        → routing configuration<br>  pages/         → route-level components<br>  components/    → reusable UI components<br>  services/      → API communication<br>  hooks/         → reusable logic<br>  store/         → global state (placeholder)<br>  styles/        → global styles</pre><h3>Understanding the Flow</h3><p>Let’s take a real example: <strong>Users Page</strong></p><pre>UsersListPage<br>      ↓<br>UserCard<br>      ↓<br>userService<br>      ↓<br>apiClient<br>      ↓<br>API</pre><p>Or simply:</p><pre>UI → Service → API</pre><h3>Code Example</h3><h3>Service Layer</h3><pre>export const getUsers = async () =&gt; {<br>  const response = await apiClient.get(&quot;/users&quot;);<br>  return response.data;<br>};</pre><h3>Page Layer</h3><pre>const UsersListPage = () =&gt; {<br>  const [users, setUsers] = useState([]);<br><br>  useEffect(() =&gt; {<br>    getUsers().then(setUsers);<br>  }, []);<br><br>  return (<br>    &lt;div&gt;<br>      {users.map((user) =&gt; (<br>        &lt;UserCard key={user.id} {...user} /&gt;<br>      ))}<br>    &lt;/div&gt;<br>  );<br>};</pre><h3>Why This Architecture Works</h3><ul><li>keeps components clean</li><li>avoids duplication</li><li>centralizes API logic</li><li>scales well with teams</li></ul><h3>What About State Management?</h3><p>The store/ folder is intentionally flexible.</p><p>You can plug in:</p><ul><li>Redux Toolkit</li><li>Zustand</li><li>Jotai</li><li>React Context</li></ul><h3>Common Mistakes to Avoid</h3><ul><li>calling APIs directly in components</li><li>mixing routing and UI</li><li>overengineering early</li><li>unclear folder structure</li></ul><h3>Quick Recap</h3><ul><li>Separate routing, UI, and API logic</li><li>Keep components reusable</li><li>Use services for API calls</li><li>Design for scale early</li></ul><h3>GitHub Repository</h3><p>I’ve created a production-ready starter <a href="https://github.com/vaibhav110800/react-app-architecture">Github Repo</a> based on this architecture, if you found this useful, consider giving it a star ⭐</p><p>Follow me on <a href="https://www.linkedin.com/in/vaibhav-thakur-24aa38174/">LinkedIn</a> and <a href="https://www.instagram.com/vaibhav11t/">Instagram</a> for more dev insights and projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8977501b25f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Interviewed at UiPath (Frontend SDE-2): React Machine Coding, LLD, DSA & One Brutal Reality Check]]></title>
            <link>https://medium.com/@vaibhav11t/i-interviewed-at-uipath-frontend-sde-2-react-machine-coding-lld-dsa-one-brutal-reality-check-cbd08859e99d?source=rss-dc43f28033f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbd08859e99d</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[coding-interviews]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[frontend-development]]></category>
            <dc:creator><![CDATA[Vaibhav Thakur]]></dc:creator>
            <pubDate>Mon, 02 Mar 2026 07:43:52 GMT</pubDate>
            <atom:updated>2026-03-02T07:43:52.764Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k3bf2XF6YwGxl121dGJNCQ.jpeg" /></figure><p>Most interview experiences are written after offers.<br>This one isn’t.</p><p>I recently interviewed at <strong>UiPath for a Frontend SDE-2 role</strong>. The process was structured, the interviewers were sound, helpful, and punctual, and the discussions were genuinely good. The entire process spanned <strong>~1.5 weeks</strong>, with <strong>three 1-hour rounds</strong>.</p><p>I didn’t get the offer — and that’s exactly why this experience is worth sharing. If you’re preparing for frontend roles at product companies, I hope this helps you prepare better (or at least set the right expectations).</p><h3>Interview Process Overview</h3><ul><li><strong>Role:</strong> Frontend SDE-2</li><li><strong>Rounds:<br>1. </strong>React Machine Coding<br>2. Low-Level Design (LLD)<br>3. DSA</li><li><strong>Format:</strong> Virtual</li><li><strong>Timeline:</strong> ~1.5 weeks</li></ul><p>Quick note: all interviewers were respectful, communicative, and on time — which really improves the overall experience.</p><h3>Round 1: React Machine Coding (Confidence vs HTML Basics)</h3><p>The first round was a <strong>React machine-coding round</strong>.</p><h4>Problem (High Level)</h4><ul><li>Given an API URL:<br>1. Fetch data<br>2. Store it<br>3. Display it in an <strong>HTML table</strong></li><li>Handle:<br>1. Loading state<br>2. Error state</li><li>Add <strong>frontend-level filtering</strong> by name</li></ul><p>Sounds simple.</p><p>Until it isn’t.</p><h4>The “Why Is My Brain Blank?” Moment</h4><p>The thing that stalled me initially wasn’t React or state management — it was <strong>HTML table syntax</strong>.</p><p>We build scalable systems, discuss performance optimizations, and suddenly &lt;table&gt;&lt;tr&gt;&lt;td&gt; feels unfamiliar.</p><h4>How the Round Went</h4><p>Once past that:</p><ul><li>Clean component structure</li><li>Proper loading and error handling</li><li>Name-based filtering</li><li>I explained my thought process continuously</li></ul><p>I completed the main task in ~<strong>45 minutes</strong>, after which I was given a <strong>bonus problem</strong>.</p><h4>Bonus Task</h4><ul><li>Add row-selection using checkboxes</li><li>Implement <strong>“Select All”</strong></li><li>Manage selection state cleanly</li></ul><p>I was asked to use <strong>TypeScript</strong>, which worked in my favor. Strong typing made state and props management much clearer.</p><p>Overall, this round went well.</p><h3>Round 2: Low-Level Design (Structure &gt; Code)</h3><p>This round started with clear expectations:</p><blockquote>“We won’t focus much on running code — we want to see how you structure it.”</blockquote><h4>Problem</h4><p>Design a frontend solution for an <strong>organization hierarchy</strong>:</p><ul><li>Inverted tree structure</li><li>Each user can have sub-ordinates</li><li>Expanding a user opens a new subtree</li></ul><h4>My Approach</h4><p>I focused on:</p><ul><li>Clear <strong>interfaces</strong> for users and hierarchy</li><li>Logical component breakdown</li><li><strong>Recursive rendering</strong> for the tree</li><li>Explaining data flow and state ownership</li></ul><p>The core idea was simple: a tree component rendering itself.</p><h4>Reflection</h4><p>This round went <strong>slightly better than average</strong>.</p><ul><li>Concepts were clear</li><li>The approach was aligned</li></ul><p>That said, I felt I could’ve been <strong>more vocal</strong>, especially around trade-offs and edge cases.</p><h3>Round 3: DSA (The Reality Check)</h3><p>This was the toughest round.</p><h4>Questions Asked</h4><ul><li><a href="https://leetcode.com/problems/burst-balloons/"><strong>LeetCode 312 — Burst Balloons</strong></a> (DP, Hard)</li><li><a href="https://leetcode.com/problems/course-schedule/"><strong>LeetCode 207 — Course Schedule</strong></a> (Graph, Medium)</li></ul><h4>How It Went</h4><p>I wasn’t able to reach a <strong>complete working solution</strong> for either problem within the interview time.</p><p>What I did manage:</p><ul><li>Explained my thinking clearly</li><li>Discussed brute-force and optimizations</li><li>Walked through DP / graph approaches conceptually</li></ul><p>But conceptual clarity alone wasn’t enough.</p><h3>Outcome &amp; Feedback</h3><p>The rejection was primarily due to the <strong>DSA round</strong>, which matched my own assessment.</p><ul><li>Weakness in <strong>DP and graph fundamentals</strong></li><li>I also felt I needed stronger verbal articulation in the LLD round</li></ul><p>No vague feedback — just a clear gap.</p><h3>What I Learned</h3><p>This experience reinforced a few things:</p><ul><li><strong>DSA is non-negotiable</strong>, even for frontend-focused roles</li><li>If it’s on your resume, <strong>you must own it</strong></li><li>Strong React/TypeScript skills help — but they don’t compensate for weak DSA</li><li>Communication matters</li><li>Mock interviews expose gaps early</li></ul><p>I used <a href="https://www.tryexponent.com/practice"><strong>Exponent</strong></a> for mock interviews, which helped simulate real interview pressure.</p><h3>Final Thoughts</h3><p>I didn’t walk away with an offer, but I walked away with clarity — and that still counts.</p><p>UiPath has a solid interview process and clear expectations. If you’re preparing for similar roles, I hope this breakdown helps you focus on the right areas <em>before</em> you hear “DP and graphs” in an interview.</p><p>If this helped, feel free to share or comment — we’re all figuring this out as we go.</p><p>Follow me on <a href="https://www.linkedin.com/in/vaibhav-thakur-24aa38174/">LinkedIn</a>, <a href="https://github.com/vaibhav110800">GitHub</a>, and <a href="https://www.instagram.com/vaibhav11t/">Instagram</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbd08859e99d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Design Tips for Frontend Engineers: Lessons from Building Real Features]]></title>
            <link>https://medium.com/@vaibhav11t/system-design-tips-for-frontend-engineers-lessons-from-building-real-features-1adc059f0b45?source=rss-dc43f28033f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/1adc059f0b45</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[bangalore]]></category>
            <dc:creator><![CDATA[Vaibhav Thakur]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 16:45:17 GMT</pubDate>
            <atom:updated>2026-02-09T16:45:17.849Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1AnAm-5LDZpnvHbH" /><figcaption>Photo by <a href="https://unsplash.com/@rocinante_11?utm_source=medium&amp;utm_medium=referral">Mick Haupt</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When frontend engineers hear <em>system design</em>, many of us mentally check out.</p><p>We think of distributed systems, load balancers, Kafka, CAP theorem — things that feel far removed from our day-to-day work of building UIs.</p><p>But after giving multiple frontend interviews and building small but non-trivial projects, I’ve realized something important:</p><blockquote><strong><em>Frontend system design is not about infrastructure.<br>It’s about how you design features, interfaces, and boundaries.</em></strong></blockquote><p>This article captures how my thinking evolved — through interviews and hands-on projects — and how frontend engineers can approach system design in a way that actually matches what interviewers look for.</p><h3>What “System Design” Means in Frontend Interviews</h3><p>In frontend interviews, system design usually translates to questions like:</p><ul><li>“How would you design this feature?”</li><li>“How would components communicate?”</li><li>“Where would state live?”</li><li>“How would this scale when requirements change?”</li></ul><p>They are <strong>not</strong> asking you to design Facebook’s backend.</p><p>They want to see:</p><ul><li>How you break a problem down</li><li>How you define responsibilities</li><li>How you design interfaces and contracts</li><li>How you think beyond the first version</li></ul><p>In short: <strong>your ability to think in systems, not components.</strong></p><h3>My Default Approach to Designing Any Frontend Feature</h3><p>I used to jump straight into:</p><blockquote><em>“Let’s create components and wire some state.”</em></blockquote><p>That works… until it doesn’t.</p><p>Now, my mental flow looks like this:</p><ul><li><strong>Understand the feature behavior</strong></li><li><strong>Identify actors and events</strong></li><li><strong>Define data contracts and interfaces</strong></li><li><strong>Design logic layers</strong></li><li><strong>Map them to UI components</strong></li></ul><p>Notice how <em>components come late</em> in the process.</p><p>Because components are just <strong>consumers of behavior</strong>, not owners of it.</p><h3>Designing Interfaces Before Components (OOP Thinking in FE)</h3><p>One thing interviewers consistently probe is <em>design clarity</em>.</p><p>Even in JavaScript or React, <strong>OOP concepts still matter</strong>:</p><ul><li>Responsibility</li><li>Encapsulation</li><li>Clear APIs</li></ul><p>Instead of asking:</p><blockquote><em>“What components do I need?”</em></blockquote><p>Ask:</p><ul><li>What are the core entities?</li><li>What operations should they expose?</li><li>What should the UI <em>not</em> know about?</li></ul><p>For example, while building a simple game or simulation, I stopped thinking in JSX and started thinking in interfaces like:</p><ul><li>A controller that manages rules</li><li>A state object that represents the system</li><li>A set of events that drive transitions</li></ul><p>The UI simply <em>renders state and dispatches intent</em>.</p><p>This separation instantly makes:</p><ul><li>Testing easier</li><li>Changes safer</li><li>Interviews smoother 😄</li></ul><h3>State, Events, and Why Predictability Matters</h3><p>Most frontend “system design” problems boil down to:</p><ul><li><strong>State</strong></li><li><strong>Events</strong></li><li><strong>Transitions</strong></li></ul><p>Projects like a <strong>LUDO game</strong> or a <strong>traffic light simulation</strong> made this painfully obvious.</p><p>Even though they’re small projects, they force you to answer hard questions:</p><ul><li>Who owns the state?</li><li>What happens when multiple events fire?</li><li>How do we prevent impossible states?</li></ul><p>I learned quickly that:</p><ul><li>Centralized, predictable state beats scattered local state</li><li>Explicit transitions are better than hidden side effects</li><li>Debuggability is more important than cleverness</li></ul><p>These lessons directly translate to real features like:</p><ul><li>Checkout flows</li><li>Multi-step forms</li><li>Real-time dashboards</li></ul><h3>Small Projects, Big Design Lessons</h3><p>I don’t consider projects like LUDO or traffic lights impressive on their own.</p><p>What <em>was</em> valuable is what they forced me to practice:</p><ul><li>Modeling behavior before UI</li><li>Thinking in finite states</li><li>Designing extensible logic</li></ul><p>They act as <strong>safe sandboxes</strong> to practice system design without production pressure.</p><p>And honestly, interviewers care more about <em>how you think</em> than <em>what you built</em>.</p><h3>Common Mistakes I’ve Made (and Still Catch Myself Making)</h3><p>Some honest ones:</p><ul><li>Mixing business logic inside components</li><li>Designing only for the current requirement</li><li>Over-engineering state too early</li><li>Not documenting assumptions and transitions</li></ul><p>Every time I fixed one of these, my designs became clearer — and interviews became easier.</p><h3>Final Thoughts</h3><p>Frontend system design is not a separate skill you magically gain at “senior level”.</p><p>It’s something you train deliberately by:</p><ul><li>Designing features top-down</li><li>Thinking in interfaces and contracts</li><li>Treating UI as a rendering layer</li><li>Practicing with small, behavior-heavy systems</li></ul><p>You don’t need distributed systems knowledge to be good at frontend system design.</p><p>You need <strong>clarity of thought</strong>.</p><p>And that’s a skill every frontend engineer can build.</p><p><em>If you’re a front-end engineer who thinks system design is only for backend or senior roles, try looking at your everyday work differently. You might realize you’ve been designing systems all along — just without calling them that.</em></p><p>Follow me on <a href="https://www.linkedin.com/in/vaibhav-thakur-24aa38174/">LinkedIn</a>, <a href="https://github.com/vaibhav110800">GitHub</a>, and <a href="https://www.instagram.com/vaibhav11t/">Instagram</a> for more dev insights and projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1adc059f0b45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best One-Night & Weekend Trips Near Bangalore: Bike Rides & Hikes]]></title>
            <link>https://medium.com/@vaibhav11t/best-one-night-weekend-trips-near-bangalore-bike-rides-hikes-891998f2370b?source=rss-dc43f28033f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/891998f2370b</guid>
            <category><![CDATA[trekking]]></category>
            <category><![CDATA[travel]]></category>
            <category><![CDATA[bangalore]]></category>
            <category><![CDATA[hiking]]></category>
            <category><![CDATA[weekend]]></category>
            <dc:creator><![CDATA[Vaibhav Thakur]]></dc:creator>
            <pubDate>Fri, 26 Dec 2025 12:58:46 GMT</pubDate>
            <atom:updated>2025-12-26T12:58:46.500Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z0FOeBHvgj7jAjN8" /><figcaption>Photo by <a href="https://unsplash.com/@csoref?utm_source=medium&amp;utm_medium=referral">Colton Duke</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Working full-time doesn’t leave much room for long vacations. Over the last couple of years, I started doing <strong>one-night trips and short weekend treks around Bangalore</strong> — sometimes on a bike, sometimes with trek groups.</p><p>All these places are <strong>roughly within 100–300 km of Bangalore</strong> and are perfect if you want a quick reset without taking too many leaves.</p><h3>One-Night Trips Near Bangalore</h3><p><em>(Leave late evening / night, come back the next day)</em></p><h4><strong>Savandurga (≈ 65 km)</strong></h4><ul><li><strong>Type:</strong> Sunrise trek</li><li><strong>How I went:</strong> Bike</li><li><strong>Trail:</strong> ~4 km one way</li><li><strong>Difficulty:</strong> Easy overall, some steep sections can feel tough if you’re not active</li><li><strong>Why it works:</strong> Close to Bangalore, great sunrise payoff</li><li><strong>Memory:</strong> Steep and slightly risky sections in misty weather after sunrise — thrilling and humbling</li></ul><h4><strong>Devarayanadurga (DD Hills) (≈ 90 km)</strong></h4><ul><li><strong>Type:</strong> Sunrise viewpoint</li><li><strong>How I went:</strong> Bike</li><li><strong>Hike:</strong> Not a trek</li><li><strong>Difficulty:</strong> Easy</li><li><strong>Why it works:</strong> Pure ride + view combo</li><li><strong>Memory:</strong> Riding through a dark, dense forest and seeing the city wake up from the top</li></ul><h4><strong>Mandaragiri Hills (≈ 80 km)</strong></h4><ul><li><strong>Type:</strong> Sunrise temple visit</li><li><strong>How I went:</strong> Bike</li><li><strong>Hike:</strong> No real hike</li><li><strong>Difficulty:</strong> Easy</li><li><strong>Why it works:</strong> Calm, scenic, less exhausting</li><li><strong>Memory:</strong> A cloud bed during sunrise and the peacock-shaped Jain temple and nearby alluring Mydala Lake</li></ul><h4><strong>Anthargange Cave Exploration (≈ 70 km)</strong></h4><ul><li><strong>Type:</strong> Cave exploration + sunrise</li><li><strong>How I went:</strong> Travel agency</li><li><strong>Duration:</strong> ~1 hour cave exploration + hill walk</li><li><strong>Difficulty:</strong> Easy</li><li><strong>Why it works:</strong> Unique experience close to Bangalore</li><li><strong>Memory:</strong> Pitch-dark caves opening into a peaceful sunrise in Kolar district</li></ul><h4><strong>Madhugiri Fort (≈ 110 km)</strong></h4><ul><li><strong>Type:</strong> Night trek + sunrise</li><li><strong>How I went:</strong> Travel agency</li><li><strong>Trail:</strong> ~2.5–3 km one way</li><li><strong>Difficulty:</strong> Easy</li><li><strong>Why it works:</strong> Short, steep and rocky ascent but rewarding</li><li><strong>Memory:</strong> Cloudy weather and fort ruins, gateways, and watchtowers at the top</li></ul><h4><strong>Uttari Betta (≈ 90 km)</strong></h4><ul><li><strong>Type:</strong> Night trek + sunrise</li><li><strong>How I went:</strong> Travel agency</li><li><strong>Trail:</strong> ~3–3.5 km one way</li><li><strong>Difficulty:</strong> Easy</li><li><strong>Why it works:</strong> One of the best beginner sunrise treks</li><li><strong>Memory:</strong> Walking through a village at night, low clouds, massive rocks, and lush greenery everywhere</li></ul><h4><strong>Skandagiri (≈ 60 km)</strong></h4><ul><li><strong>Type:</strong> Night trek + sunrise</li><li><strong>How I went:</strong> Travel agency</li><li><strong>Trail:</strong> ~4 km one way</li><li><strong>Difficulty:</strong> Moderate for beginners, easy if you’re active</li><li><strong>Why it works:</strong> Classic night trek near Bangalore</li><li><strong>Memory:</strong> Orange sun rising while flights passed right in front of it — surreal because of the nearby airport</li></ul><h3>Full Weekend Trips</h3><p><em>(Need more time, but worth every step)</em></p><h4>Tadiandamol, Coorg (≈ 270 km)</h4><ul><li><strong>Type:</strong> Trek</li><li><strong>How I went:</strong> Trek agency</li><li><strong>Trail:</strong> ~7–8 km one way</li><li><strong>Difficulty:</strong> Moderate</li><li><strong>Ideal duration:</strong> 2D/1N</li><li><strong>Why it works:</strong> Highest peak in Coorg with steady terrain</li><li><strong>Memory:</strong> Endless stretches of lush green forest — calm and grounding</li></ul><h4><strong>Bandaje Falls, Chikmagalur (≈ 300 km)</strong></h4><ul><li><strong>Type:</strong> Waterfall trek</li><li><strong>How I went:</strong> Trek agency</li><li><strong>Trail:</strong> ~7–8 km one way</li><li><strong>Difficulty:</strong> Moderate</li><li><strong>Ideal duration:</strong> 2D/1N</li><li><strong>Why it works:</strong> Monsoon magic at its best</li><li><strong>Memory:</strong> Trekking in heavy rain, low clouds, and dense green forest the entire way</li></ul><h3>What these trips taught me</h3><ul><li>You don’t need long vacations to feel refreshed</li><li>Physical exhaustion often clears mental clutter</li><li>One-night trips are <strong>underrated therapy</strong> for working professionals</li></ul><p>Sometimes, all it takes is one sunrise outside the city.</p><h3>Travel groups I went with</h3><p>For some treks, I went with:</p><ul><li><strong>Bangalore Mountaineering Club (BMC)</strong></li><li><strong>Tripbae</strong></li><li><strong>Namma Trip</strong></li><li><strong>Escape2Explore</strong></li></ul><p>(Just mentioning them for reference — always research and choose what fits you best.)</p><h3>Final note</h3><p>If you’re in Bangalore and constantly postponing travel because of time — <strong>start small</strong>. One night is often enough.</p><p>I share bits from these trips — rides, treks, and quiet moments — connect with me on <a href="https://www.instagram.com/vaibhav11t/?source=user_about----------------------dc43f28033f1----------------------"><strong>Instagram</strong></a> and <a href="http://www.youtube.com/@VaibhavThakur1108?source=user_about----------------------dc43f28033f1----------------------"><strong>Youtube</strong></a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=891998f2370b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Practical Guide to Real-Time Chat with WebSockets]]></title>
            <link>https://medium.com/@vaibhav11t/a-practical-guide-to-real-time-chat-with-websockets-82a5ddf40984?source=rss-dc43f28033f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/82a5ddf40984</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Vaibhav Thakur]]></dc:creator>
            <pubDate>Mon, 15 Dec 2025 15:55:15 GMT</pubDate>
            <atom:updated>2025-12-15T15:55:15.074Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S6qH9VddbeO6rVV_" /><figcaption>Photo by <a href="https://unsplash.com/@alexbemore?utm_source=medium&amp;utm_medium=referral">Alexander Shatov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Ever wondered how chat apps like Slack or WhatsApp work? The secret is WebSockets. I recently built a simple real-time chat application to understand how WebSockets work, and it turned out to be much simpler than I expected!</p><p>This is a <strong>simple POC (Proof of Concept)</strong> to help you understand WebSocket fundamentals without getting overwhelmed. No complex frameworks, just vanilla JavaScript and Node.js.</p><h3>Why WebSockets?</h3><p>Traditional HTTP works like a question-and-answer session: the client asks, the server responds, then the connection closes. But what if you need continuous, two-way communication?</p><p><strong>HTTP Polling (The Old Way):</strong></p><pre>// Check for new messages every second - inefficient!<br>setInterval(() =&gt; {<br>  fetch(&#39;/api/messages&#39;).then(res =&gt; res.json());<br>}, 1000);</pre><p><strong>Problems:</strong></p><ul><li>Wastes bandwidth with constant requests</li><li>Creates server load</li><li>Not truly real-time (delays up to 1 second)</li></ul><p><strong>WebSockets (The Better Way):</strong></p><ul><li>Opens a persistent connection</li><li>Server and client can send messages anytime</li><li>True real-time with minimal latency</li><li>Much more efficient</li></ul><h3>What I Built</h3><p>A simple chat app with:</p><ul><li>Real-time messaging</li><li>Typing indicators</li><li>Online user count</li><li>Auto-reconnection</li></ul><p><strong>Total code:</strong> Just ~250 lines across 5 files!</p><h3>The Architecture</h3><pre>Client 1 ←→ WebSocket Server ←→ Client 2<br>                  ↕<br>              Client 3</pre><p>The server broadcasts messages to all connected clients in real-time.</p><h3>Setting Up the WebSocket Server</h3><pre>const express = require(&#39;express&#39;);<br>const WebSocket = require(&#39;ws&#39;);<br>const http = require(&#39;http&#39;);<br><br>const app = express();<br>const server = http.createServer(app);<br>const wss = new WebSocket.Server({ server });<br>const clients = new Map(); // Store connected users<br>wss.on(&#39;connection&#39;, (ws) =&gt; {<br>  console.log(&#39;New client connected&#39;);<br>  <br>  ws.on(&#39;message&#39;, (data) =&gt; {<br>    const message = JSON.parse(data);<br>    handleMessage(ws, message);<br>  });<br>  <br>  ws.on(&#39;close&#39;, () =&gt; {<br>    const username = clients.get(ws);<br>    clients.delete(ws);<br>    broadcast({ type: &#39;user_left&#39;, username });<br>  });<br>});<br>server.listen(3000);</pre><p><strong>Key WebSocket Events:</strong></p><ul><li>connection: Client connects</li><li>message: Client sends data</li><li>close: Client disconnects</li></ul><h3>Broadcasting Messages</h3><p>The magic of chat apps — sending one message to everyone:</p><pre>function broadcast(data, excludeClient = null) {<br>  const message = JSON.stringify(data);<br>  <br>  wss.clients.forEach((client) =&gt; {<br>    if (client !== excludeClient &amp;&amp; client.readyState === WebSocket.OPEN) {<br>      client.send(message);<br>    }<br>  });<br>}</pre><h3>Connecting to WebSocket</h3><pre>const ws = new WebSocket(&#39;ws://localhost:3000&#39;);<br><br>ws.onopen = () =&gt; {<br>  console.log(&#39;Connected!&#39;);<br>  ws.send(JSON.stringify({ type: &#39;join&#39;, username: &#39;John&#39; }));<br>};<br>ws.onmessage = (event) =&gt; {<br>  const data = JSON.parse(event.data);<br>  displayMessage(data);<br>};<br>ws.onclose = () =&gt; {<br>  console.log(&#39;Disconnected&#39;);<br>  setTimeout(() =&gt; connectWebSocket(), 3000); // Auto-reconnect<br>};</pre><h3>Sending Messages</h3><pre>function sendMessage(text) {<br>  if (ws.readyState === WebSocket.OPEN) {<br>    ws.send(JSON.stringify({<br>      type: &#39;chat&#39;,<br>      message: text<br>    }));<br>  }<br>}</pre><p><strong>Important:</strong> Always check if the connection is open before sending!</p><h3>Key Learnings</h3><p><strong>1. WebSocket States</strong></p><p>WebSockets have 4 states:</p><ul><li>CONNECTING (0): Establishing connection</li><li>OPEN (1): Ready to communicate</li><li>CLOSING (2): Closing connection</li><li>CLOSED (3): Connection closed</li></ul><p>Always check the state:</p><pre>if (ws.readyState === WebSocket.OPEN) {<br>  ws.send(data);<br>}</pre><p><strong>2. Message Structure</strong></p><p>Use a consistent message format:</p><pre>// Good - structured and extensible<br>{ type: &#39;chat&#39;, message: &#39;Hello&#39;, username: &#39;John&#39; }<br><br>// Bad - hard to parse and extend<br>&#39;John: Hello&#39;</pre><p><strong>3. Handle Disconnections</strong></p><p>Real apps need reconnection logic. I used a simple approach:</p><pre>ws.onclose = () =&gt; {<br>  setTimeout(connectWebSocket, 3000); // Retry after 3 seconds<br>};</pre><p><strong>4. Security Basics</strong></p><ul><li><strong>Escape user input</strong> to prevent XSS attacks</li><li>Use <strong>WSS (secure WebSocket)</strong> in production</li><li><strong>Validate messages</strong> on the server</li><li>Implement <strong>rate limiting</strong> for messages</li></ul><h3>Challenges I Faced</h3><p><strong>Challenge 1: Timing Issues</strong></p><p>Sending messages immediately after creating the connection failed because the connection wasn’t open yet.</p><p><strong>Solution:</strong> Wait for the onopen event.</p><p><strong>Challenge 2: Typing Indicator Spam</strong></p><p>Every keystroke sent a message, flooding the server.</p><p><strong>Solution:</strong> Debounce the typing events:</p><pre>let typingTimeout;<br>messageInput.addEventListener(&#39;input&#39;, () =&gt; {<br>  clearTimeout(typingTimeout);<br>  sendTyping(true);<br>  <br>  typingTimeout = setTimeout(() =&gt; {<br>    sendTyping(false);<br>  }, 1000);<br>});</pre><h3>When to Use WebSockets</h3><p><strong>Use WebSockets for:</strong></p><ul><li>Chat applications</li><li>Live notifications</li><li>Collaborative tools (like Google Docs)</li><li>Real-time dashboards</li><li>Multiplayer games</li></ul><p><strong>Don’t use WebSockets for:</strong></p><ul><li>Simple REST APIs</li><li>Infrequent updates (use polling or Server-Sent Events)</li><li>One-way communication (SSE is simpler)</li></ul><h3>Production Considerations</h3><p>This POC is great for learning, but production apps need:</p><ol><li><strong>Authentication</strong> — Verify users before connecting</li><li><strong>Message persistence</strong> — Store chat history in a database</li><li><strong>Scaling</strong> — Use Redis Pub/Sub for multiple server instances</li><li><strong>Rate limiting</strong> — Prevent spam and abuse</li><li><strong>SSL/TLS</strong> — Use wss:// instead of ws://</li></ol><h3>What’s Next?</h3><p>Now that I understand the basics, I’m planning to explore:</p><ul><li>User authentication with JWT</li><li>Persistent chat history</li><li>Private messaging</li><li>File sharing</li><li>Deployment to production</li></ul><h3>Final Thoughts</h3><p>Building this POC taught me that <strong>WebSockets aren’t as complex as they seem</strong>. The core concept is simple: open a connection, send and receive messages.</p><p>The real complexity comes from handling edge cases — disconnections, scaling, security — but those are problems you tackle as you grow.</p><p><strong>My advice:</strong> Start with a simple POC like this. Once you understand the fundamentals, everything else makes sense.</p><h3>Resources</h3><ul><li><a href="https://developer.mozilla.org/en-US/docs/Web/API/WebSocket">MDN WebSocket API</a></li><li><a href="https://github.com/websockets/ws">ws Library for Node.js</a></li><li><a href="https://github.com/vaibhav110800/websocket-chat-poc">GitHub Repository</a></li></ul><h3>Connect With Me</h3><p>Questions or feedback? Connect with me on <a href="https://www.linkedin.com/in/vaibhav-thakur-24aa38174/">LinkedIn</a>, <a href="https://github.com/vaibhav110800">GitHub</a>, and <a href="https://www.instagram.com/vaibhav11t/">Instagram</a>.</p><p>If you found this helpful, give it a clap 👏 and share with others learning WebSockets!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82a5ddf40984" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Front-End to Algorithms: How I Built My Problem-Solving Mindset]]></title>
            <link>https://medium.com/@vaibhav11t/from-front-end-to-algorithms-how-i-built-my-problem-solving-mindset-6fb266a602d4?source=rss-dc43f28033f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fb266a602d4</guid>
            <category><![CDATA[problem-solving]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[careers]]></category>
            <dc:creator><![CDATA[Vaibhav Thakur]]></dc:creator>
            <pubDate>Sat, 08 Nov 2025 14:01:39 GMT</pubDate>
            <atom:updated>2025-11-08T14:01:39.634Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*WPOh4lQyIZ7RGEBeR8NCxg.gif" /></figure><p>When I started my career as a front-end developer, “problem-solving” mostly meant figuring out why the UI broke after a merge or why the API wasn’t responding.<br>I thought I was good at it — until I opened my first LeetCode problem.</p><p>That day, I realized how different <em>real problem-solving</em> is from <em>debugging code</em>.</p><p>For a long time, I avoided Data Structures and Algorithms (DSA). It felt distant from the world of React components and API integrations. But somewhere between late-night debugging sessions and code reviews, I began noticing something — the same patterns I was struggling to learn in DSA actually existed in front-end engineering too, just in a disguised form.</p><h3>The Shift: From Syntax to Thinking</h3><p>At first, I practiced DSA only to “get better at interviews.” But soon, I started noticing a quiet shift in my thinking.</p><p>I was no longer writing code reactively; I was anticipating edge cases, reasoning about complexity, and breaking problems into smaller solvable chunks — just like I did with algorithms.</p><p>This shift wasn’t about mastering syntax. It was about <strong>thinking in patterns</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*1zwJhm0rH1m7gFewtSYq9g.jpeg" /></figure><h3>DSA Patterns That Changed My Approach</h3><p>I didn’t memorize all 200+ problems. Instead, I focused on a few <strong>core patterns</strong> that started appearing everywhere:</p><ul><li><strong>Sliding Window:</strong> Helped me optimize UI state updates and debounce-heavy operations.</li><li><strong>Two Pointers:</strong> Trained me to look for minimalistic, space-efficient solutions in code.</li><li><strong>Recursion &amp; Divide and Conquer:</strong> Made me comfortable designing reusable components — functions that call themselves conceptually, just like React hooks.</li><li><strong>Dynamic Programming:</strong> Taught me to think in terms of reusability and caching — the same logic that powers memoization in front-end frameworks.</li></ul><p>Each pattern wasn’t just an algorithmic trick — it was a new lens through which I viewed problems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*4gdWqYFwcVFCwRmRKOa9zw.jpeg" /></figure><h3>The Real Win</h3><p>I stopped fearing new problems.<br>Whether it was a tough API integration, a tricky layout bug, or a DSA question — I could now approach it systematically.</p><p>DSA didn’t just make me a better coder; it made me <strong>more patient, structured, and confident</strong> in how I solve problems.</p><p>And the funny thing? I now find the same satisfaction in optimizing a React component’s re-render cycle as I do in solving a LeetCode medium question. Both are puzzles — just on different canvases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*4Kc0pZa17txuu3JKgRuTGg.png" /></figure><h3>My Takeaway</h3><p>You don’t have to be a “DSA nerd” to benefit from algorithmic thinking.<br>You just need to notice how the same principles apply everywhere — whether you’re optimizing code in production or solving problems on a whiteboard.</p><p>In the end, <strong>problem-solving isn’t a skill you learn once; it’s a mindset you keep building.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*KRwQ6vFmYoS4Ds-kv2Tb2A.jpeg" /></figure><p><em>If you’re a front-end engineer who’s been avoiding DSA because it feels irrelevant — try looking at it differently. You might just find it’s been shaping the way you think all along.</em></p><p>Follow me on <a href="https://www.linkedin.com/in/vaibhav-thakur-24aa38174/">LinkedIn</a>, <a href="https://github.com/vaibhav110800">GitHub</a>, and <a href="https://www.instagram.com/vaibhav11t/">Instagram</a> for more dev insights and projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fb266a602d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[11 Books, 1 Year, and Countless Reflections]]></title>
            <link>https://medium.com/@vaibhav11t/11-books-1-year-and-countless-reflections-cb78bbe0a401?source=rss-dc43f28033f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb78bbe0a401</guid>
            <category><![CDATA[books]]></category>
            <category><![CDATA[philosophy]]></category>
            <category><![CDATA[habits]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[reading]]></category>
            <dc:creator><![CDATA[Vaibhav Thakur]]></dc:creator>
            <pubDate>Mon, 13 Oct 2025 06:05:36 GMT</pubDate>
            <atom:updated>2025-10-13T06:05:36.166Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tVR84bsaaXTaA8Et" /><figcaption>Photo by <a href="https://unsplash.com/@napender?utm_source=medium&amp;utm_medium=referral">Napendra Singh</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Around this week last year, I picked up my first book — <em>As a Man Thinketh</em>. I wasn’t setting any goal or challenge. I just wanted to start. One of my colleagues had the book, it was short, and I thought, <em>why not</em>.</p><p>A year later, I’ve finished 11 books.<br>Some were easy, some heavy, but each one left a small mark — changing how I think, react, or look at life. This one year of reading didn’t make me wiser, but definitely made me <em>quieter inside</em>.</p><h3>1. As a Man Thinketh — the beginning of awareness</h3><p>This was where it all started.<br>I was in a curious mindset, just planning to explore reading. The book’s core idea — <em>every thought is like a seed; what you sow, you shall reap</em> — struck me deeply.</p><p>It made me gradually more aware of my thoughts. I started noticing what goes on in my head — how easily negative thoughts come and how consciously they can be replaced. That small shift changed a lot. Finishing this book gave me my first insight into how the mind works, and my reading journey began from here.</p><h3>2. Bhagavad Gita — the grounding in action</h3><p>The Gita was with me since college. I had tried reading it a few times, but it never connected. This time, it did. Every verse started making sense.</p><p>The biggest lesson for me was simple but powerful — <em>do your duty with full attention, without worrying about the result.</em> That one teaching changed how I looked at work, workouts, and even daily challenges.</p><p>If I had to sum up its effect in one line: <em>Focus on actions; leave the rest to God.</em></p><h3>3. Meditations — the calm of stoic thought</h3><p>Stoic philosophy fascinated me. Reading Marcus Aurelius felt like talking to a calm, wise voice reminding me of the same truth the Gita spoke — do your duty, stay with the natural order, and accept what comes.</p><p>The book introduced me to the idea of <em>logos</em> — the universal order of things. It taught me to stay centered, to act without complaining, and to move with life instead of fighting it. I felt both peace and introspection after finishing it.</p><h3>4. Crime and Punishment — the depth of human mind</h3><p>After a long list of philosophy and self help books, I wanted to step into something different — something that explores the human mind in all its contradictions. Dostoevsky had always intrigued me, so I picked <em>Crime and Punishment</em>.</p><p>It wasn’t an easy read. At first, it felt heavy and unsettling — every character was raw and painfully human. But that’s what made it so gripping. The book dives deep into the human mind — its conflicts, guilt, and search for meaning.</p><p>There were days I found myself thinking about the protagonist, analysing his choices, trying to understand what truly drives people to act the way they do. It’s one of those books that doesn’t just end — it lingers, quietly reshaping how you look at right, wrong, and everything in between.</p><h3>Other companions along the way</h3><p>Each of the other seven books added something unique to the journey:</p><ul><li><strong><em>Mindset</em></strong> taught me that every situation gives two options — act progressively or stay stuck.</li><li><strong><em>The Power of Your Subconscious Mind</em></strong> made me aware of how thoughts shape life.</li><li><strong><em>Karm Kaise Kare</em> </strong>explained the Jain view of <strong><em>karma</em></strong> and <strong><em>purusharth</em></strong> — how action can reverse circumstances.</li><li><strong><em>12 Rules for Life</em></strong> gave me structure — lessons across health, money, family, and work.</li><li><strong><em>The Richest Man in Babylon</em> </strong>taught discipline in handling money — to use it as a tool, not become its slave.</li><li><strong><em>Chanakya Neeti</em></strong> was sharp and practical, with wisdom still relevant today.</li><li><strong><em>Atomic Habits</em></strong> helped me understand the science behind habits — triggers, systems, and long-term change.</li></ul><p>Each one built on the previous, layer by layer, shaping both thought and habit.</p><h3>Closing thoughts</h3><p>Looking back, this one year of reading wasn’t about finishing books — it was about understanding myself a little better through them.</p><p>From thoughts (<em>As a Man Thinketh</em>) to actions (<em>Gita</em>), from calmness (<em>Meditations</em>) to complexity (<em>Crime and Punishment</em>), each book reflected a part of life.</p><p>Reading has now become a quiet space for me — not to escape life, but to return to it with a clearer mind.</p><p>Connect with me on <a href="https://www.instagram.com/vaibhav11t/">Instagram</a> to decide whether I’m enlightened or just dramatic.</p><p>With love Vaibhav ❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb78bbe0a401" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 6 React Machine Coding Questions I Solved & My Approach]]></title>
            <link>https://medium.com/@vaibhav11t/top-6-react-machine-coding-questions-i-solved-my-approach-aa9fbf5f674f?source=rss-dc43f28033f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa9fbf5f674f</guid>
            <category><![CDATA[corporate-culture]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Vaibhav Thakur]]></dc:creator>
            <pubDate>Sat, 27 Sep 2025 09:26:42 GMT</pubDate>
            <atom:updated>2025-09-27T09:26:42.188Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0XqqfbC2C8SV5LvQ" /><figcaption>Photo by <a href="https://unsplash.com/@mkvandergriff?utm_source=medium&amp;utm_medium=referral">Maranda Vandergriff</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As frontend engineers, we’re often asked to <strong>build small but tricky components</strong> in interviews. These “machine coding” rounds test not only React knowledge but also how you structure code, handle edge cases, and think in real-world scenarios.</p><p>In this article, I’ll walk you through <strong>6 popular React machine coding questions</strong> I solved recently — along with my approach, key learnings, and code snippets.</p><p>At the end, I’ll also share resources and a GitHub repo with complete solutions.</p><h3>1. Todo App with LocalStorage</h3><p>A <strong>classic interview favorite</strong>. Build a todo list where items persist even after a refresh.</p><pre>function Todo() {<br>  const [todos, setTodos] = useState(() =&gt;<br>    JSON.parse(localStorage.getItem(&quot;todos&quot;) || &quot;[]&quot;)<br>  );<br><br>  useEffect(() =&gt; {<br>    localStorage.setItem(&quot;todos&quot;, JSON.stringify(todos));<br>  }, [todos]);<br><br>  return (<br>    &lt;&gt;<br>      &lt;input<br>        onKeyDown={e =&gt;<br>          e.key === &quot;Enter&quot; &amp;&amp; setTodos([...todos, e.currentTarget.value])<br>        }<br>      /&gt;<br>      &lt;ul&gt;<br>        {todos.map((t, i) =&gt; (<br>          &lt;li key={i}&gt;{t}&lt;/li&gt;<br>        ))}<br>      &lt;/ul&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><p><strong>Key points:</strong></p><ul><li>Lazy initializer ensures localStorage is read once.</li><li>useEffect keeps storage in sync.</li><li>Handles empty storage gracefully.</li></ul><h3>2. Debounce Search Input</h3><p>Implement a search box that <strong>waits for the user to stop typing</strong> before firing an API call.</p><pre>function useDebounce(value: string, delay: number) {<br>  const [debounced, setDebounced] = useState(value);<br><br>  useEffect(() =&gt; {<br>    const id = setTimeout(() =&gt; setDebounced(value), delay);<br>    return () =&gt; clearTimeout(id);<br>  }, [value, delay]);<br><br>  return debounced;<br>}</pre><p>Usage:</p><pre>function SearchBox() {<br>  const [query, setQuery] = useState(&quot;&quot;);<br>  const debounced = useDebounce(query, 500);<br><br>  useEffect(() =&gt; {<br>    if (debounced) console.log(&quot;API call with:&quot;, debounced);<br>  }, [debounced]);<br><br>  return &lt;input onChange={e =&gt; setQuery(e.target.value)} /&gt;;<br>}</pre><p><strong>Key points:</strong></p><ul><li>Prevents unnecessary API calls.</li><li>Custom hook makes it reusable.</li></ul><h3>3. Accordion Component</h3><p>A UI staple: expandable/collapsible sections.</p><pre>function Accordion({ items }) {<br>  const [open, setOpen] = useState&lt;number | null&gt;(null);<br><br>  return (<br>    &lt;div&gt;<br>      {items.map((it, i) =&gt; (<br>        &lt;div key={i}&gt;<br>          &lt;button onClick={() =&gt; setOpen(open === i ? null : i)}&gt;<br>            {it.title}<br>          &lt;/button&gt;<br>          {open === i &amp;&amp; &lt;p&gt;{it.content}&lt;/p&gt;}<br>        &lt;/div&gt;<br>      ))}<br>    &lt;/div&gt;<br>  );<br>}</pre><p><strong>Key points:</strong></p><ul><li>State tracks open item index.</li><li>Supports toggle behavior.</li></ul><h3>4. Star Rating Component</h3><p>A reusable <strong>rating widget</strong>.</p><pre>function StarRating({ total = 5 }) {<br>  const [rating, setRating] = useState(0);<br>  return (<br>    &lt;div&gt;<br>      {[...Array(total)].map((_, i) =&gt; (<br>        &lt;span<br>          key={i}<br>          style={{ color: i &lt; rating ? &quot;gold&quot; : &quot;gray&quot;, cursor: &quot;pointer&quot; }}<br>          onClick={() =&gt; setRating(i + 1)}<br>        &gt;<br>          ★<br>        &lt;/span&gt;<br>      ))}<br>    &lt;/div&gt;<br>  );<br>}</pre><p><strong>Key points:</strong></p><ul><li>Simple mapping of stars.</li><li>Click to set rating, highlight dynamically.</li></ul><h3>5. Modal Component</h3><p>A <strong>reusable modal</strong> with portal support.</p><pre>function Modal({ open, onClose, children }) {<br>  if (!open) return null;<br>  return ReactDOM.createPortal(<br>    &lt;div className=&quot;overlay&quot;&gt;<br>      &lt;div className=&quot;modal&quot;&gt;<br>        {children}<br>        &lt;button onClick={onClose}&gt;Close&lt;/button&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;,<br>    document.body<br>  );<br>}</pre><p>Usage:</p><pre>function App() {<br>  const [open, setOpen] = useState(false);<br>  return (<br>    &lt;&gt;<br>      &lt;button onClick={() =&gt; setOpen(true)}&gt;Open&lt;/button&gt;<br>      &lt;Modal open={open} onClose={() =&gt; setOpen(false)}&gt;<br>        &lt;h2&gt;Hello Modal&lt;/h2&gt;<br>      &lt;/Modal&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><p><strong>Key points:</strong></p><ul><li>Uses ReactDOM.createPortal.</li><li>Handles conditional rendering.</li></ul><h3>6. Infinite Scroll List</h3><p>Load more data as the user scrolls.</p><pre>function InfiniteList({ fetchMore }) {<br>  const [items, setItems] = useState&lt;number[]&gt;([]);<br>  const loader = useRef&lt;HTMLDivElement | null&gt;(null);<br><br>  useEffect(() =&gt; {<br>    const observer = new IntersectionObserver(([entry]) =&gt; {<br>      if (entry.isIntersecting) fetchMore().then(more =&gt; setItems(p =&gt; [...p, ...more]));<br>    });<br>    if (loader.current) observer.observe(loader.current);<br>    return () =&gt; loader.disconnect();<br>  }, [fetchMore]);<br><br>  return (<br>    &lt;div&gt;<br>      {items.map((i, idx) =&gt; (<br>        &lt;p key={idx}&gt;{i}&lt;/p&gt;<br>      ))}<br>      &lt;div ref={loader}&gt;Loading...&lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><p><strong>Key points:</strong></p><ul><li>Uses IntersectionObserver.</li><li>Efficient and avoids scroll event spam.</li></ul><h3>Conclusion</h3><p>These 6 problems cover <strong>core React interview areas</strong>:</p><ul><li>State management (useState, useEffect)</li><li>Reusability (custom hooks, reusable components)</li><li>UI patterns (Accordion, Modal, Rating)</li><li>Performance optimization (debounce, infinite scroll)</li></ul><p>📌 If you want to go deeper:</p><ul><li>Check out my <a href="https://github.com/vaibhav110800/react-machine-coding-prep">GitHub repo</a> with all implementations (full code + folder structure).</li><li>Practice with <a href="https://www.greatfrontend.com/interviews/gfe75">GreatFrontEnd 75 Questions</a> for consistent problem-solving.</li><li>Follow me on <a href="https://www.linkedin.com/in/vaibhav-thakur-24aa38174/">LinkedIn</a>, <a href="https://github.com/vaibhav110800">GitHub</a>, and <a href="https://www.instagram.com/vaibhav11t/">Instagram</a> for more dev insights and projects.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa9fbf5f674f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Common Mistakes React Developers Make (and How to Avoid Them)]]></title>
            <link>https://medium.com/@vaibhav11t/3-common-mistakes-react-developers-make-and-how-to-avoid-them-6c590be1e22a?source=rss-dc43f28033f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c590be1e22a</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Vaibhav Thakur]]></dc:creator>
            <pubDate>Sun, 14 Sep 2025 07:12:29 GMT</pubDate>
            <atom:updated>2025-09-14T07:12:29.339Z</atom:updated>
            <content:encoded><![CDATA[<p><em>“With great power comes great responsibility.”</em><br> — Uncle Ben (probably talking about React, not Peter Parker)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*ZUNCAJU4KWPxHViGHcMdlA.gif" /></figure><p>React gives us flexibility, speed, and power. But with that comes the risk of making mistakes that silently hurt performance and maintainability.</p><p>In this article, I’ll cover <strong>3 mistakes I see React developers (including myself) often make</strong> — and how to avoid them.</p><h3>1. Performance Pitfalls 🐌</h3><p>React re-renders are like gossip — if you don’t control them, they spread everywhere.</p><p>Common culprits:</p><ul><li>Passing <strong>inline functions as props</strong> → triggers re-renders.</li><li>Using <strong>index as a key</strong> in lists → weird UI bugs.</li><li>Forgetting <strong>lazy loading/code-splitting</strong> → big chunks slow the app.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*wEquHnYZKPYw7qgEWTR8Lw.gif" /></figure><p><strong>Quick Fixes:</strong></p><ul><li>Use React.memo, useCallback, and useMemo (but don’t overdo).</li><li>Always use <strong>stable unique keys</strong>.</li><li>Split code with React.lazy or dynamic imports.</li></ul><p>Small tweaks = faster apps + happier users.</p><h3>2. Over-Engineering Traps 🧩</h3><p>Raise your hand if you’ve added Redux to a 2-page app 🙋‍♂️</p><p>Sometimes we solve problems that don’t exist:</p><ul><li>Redux for tiny apps (Context/local state would’ve worked).</li><li>Abstracting everything into hooks/components <em>too early</em>.</li><li>Pulling giant libraries for small tasks (hello, Moment.js 👋).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*VlBiAtgyC_Ctxxp3fBWoSA.jpeg" /></figure><p><strong>Quick Fixes:</strong></p><ul><li>Start simple, scale when you <em>actually need it</em>.</li><li>Ask: <em>Will my teammate thank me for this, or curse me?</em></li><li>Remember: less code = less to debug.</li></ul><h3>3. Ignoring Bundle Size 🎒</h3><p>Your bundle is like luggage on a trip — pack too much, and everyone’s annoyed waiting for you.</p><p>Mistakes we make:</p><ul><li>Importing entire libraries (import _ from &quot;lodash&quot;) instead of just what’s needed.</li><li>Forgetting to tree-shake.</li><li>Not checking the real size impact of new dependencies.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*D4UgVSyZG9H1pOMf5qEbfA.gif" /></figure><p><strong>Quick Fixes:</strong></p><ul><li>Use <a href="https://bundlephobia.com/">Bundlephobia</a> before adding dependencies.</li><li>Import only what you need (import debounce from &quot;lodash/debounce&quot;).</li><li>Use tools like Webpack Bundle Analyzer or Vite’s build report.</li></ul><p>A lean bundle = faster load times + happier users (again).</p><h3>Closing 🎯</h3><p>React isn’t about using every hook, library, or tool you know. It’s about making <strong>smart trade-offs</strong>.</p><p>So the next time you’re writing code, ask yourself:</p><ul><li>Am I optimizing too early?</li><li>Is my bundle quietly getting bloated?</li><li>Will this design still make sense 6 months from now?</li></ul><p><strong>With great React power comes great responsibility. Use it well.</strong></p><p><em>Written by a developer who once added Redux to a login page (and regrets it).</em></p><p>Follow me on <a href="https://www.linkedin.com/in/vaibhav-thakur-24aa38174/">LinkedIn</a>, <a href="https://github.com/vaibhav110800">GitHub</a>, and <a href="https://www.instagram.com/vaibhav11t/">Instagram</a> for more dev insights, memes, and projects.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c590be1e22a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>