<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gautam</title>
    <description>The latest articles on DEV Community by Gautam (@gautam_f015817a44372df414).</description>
    <link>https://dev.to/gautam_f015817a44372df414</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4026028%2Fa51e5d1f-b110-4591-89c8-9808cf781251.jpg</url>
      <title>DEV Community: Gautam</title>
      <link>https://dev.to/gautam_f015817a44372df414</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gautam_f015817a44372df414"/>
    <language>en</language>
    <item>
      <title>MERN Interview Prep Isn't Just React Prep With Extra Steps</title>
      <dc:creator>Gautam</dc:creator>
      <pubDate>Sat, 08 Aug 2026 15:54:04 +0000</pubDate>
      <link>https://dev.to/gautam_f015817a44372df414/mern-interview-prep-isnt-just-react-prep-with-extra-steps-5h8f</link>
      <guid>https://dev.to/gautam_f015817a44372df414/mern-interview-prep-isnt-just-react-prep-with-extra-steps-5h8f</guid>
      <description>&lt;p&gt;Here's a pattern I see constantly: someone lists "MERN stack" on their resume, spends 90% of their interview prep time on React, and then gets blindsided by a question about MongoDB indexing or the Node event loop. Not because they didn't know the answer existed — because they never actually studied it as seriously as they studied hooks and re-renders.&lt;/p&gt;

&lt;p&gt;It makes sense why this happens. React is the part everyone's excited about. It's visual, it's the part you build UIs with, it's what most tutorials center around. MongoDB, Express, and Node quietly become "the stuff that connects to React" instead of three separate skill sets an interviewer is going to test just as hard.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four layers, and where people actually get caught out
&lt;/h2&gt;

&lt;p&gt;A real MERN interview loop touches all four letters, and in my experience the surprises cluster in predictable places:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MongoDB&lt;/strong&gt; — not "what is MongoDB," but &lt;em&gt;when do you embed data versus reference it with an ObjectId&lt;/em&gt;. This is a genuine design decision with real tradeoffs, and a lot of candidates have never had to reason about it out loud before.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Express&lt;/strong&gt; — middleware is the big one. Not just "what is middleware" but understanding the &lt;code&gt;(req, res, next)&lt;/code&gt; signature well enough to explain error-handling middleware specifically, and why forgetting to define one leaks a stack trace in production.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Node&lt;/strong&gt; — the event loop gets asked constantly, but in a way that trips people up: not "is Node single-threaded" (yes, sort of), but explaining &lt;em&gt;why&lt;/em&gt; it can still handle many concurrent requests despite that. That "despite that" is where the real understanding shows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;React&lt;/strong&gt; — usually the strongest area for most candidates, which is exactly why interviewers sometimes spend less time here and more time probing the other three, assuming you've already got React covered.&lt;/p&gt;

&lt;h2&gt;
  
  
  A quick self-check
&lt;/h2&gt;

&lt;p&gt;If you're prepping for a MERN-labeled role, try answering these cold, no Googling:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When would you embed a sub-document in MongoDB instead of referencing it?&lt;/li&gt;
&lt;li&gt;What's the actual difference between &lt;code&gt;process.nextTick()&lt;/code&gt; and &lt;code&gt;setImmediate()&lt;/code&gt; in Node?&lt;/li&gt;
&lt;li&gt;Why does Express recognize an error-handling middleware function specifically by its four arguments?&lt;/li&gt;
&lt;li&gt;What actually happens in the event loop between &lt;code&gt;console.log&lt;/code&gt;, a &lt;code&gt;setTimeout&lt;/code&gt;, and a resolved promise?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If any of those made you pause longer than a React hooks question would, that's useful information — it's telling you exactly where your prep has been lopsided.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where I've been drilling this
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8oilib9hawg45cmzqfn5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8oilib9hawg45cmzqfn5.png" alt="React Interview Questions 2026" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I've been working through &lt;a href="https://reactgrind.com/blog/mern-stack-interview-questions" rel="noopener noreferrer"&gt;ReactGrind's MERN stack interview questions guide&lt;/a&gt; — it's organized by layer instead of dumping everything into one undifferentiated list, which made it a lot easier to see exactly where my Node and Express knowledge was thinner than I thought. 25+ questions with real answers, not just definitions — the kind of thing you'd actually get asked to explain, not just recognize.&lt;/p&gt;

&lt;p&gt;Once the non-React layers stop being the weak point, it's worth stress-testing the React side too, since "I know hooks" and "I can explain useEffect vs useLayoutEffect under FAANG-level questioning" are not the same bar. &lt;a href="https://www.reactgrind.com/react-interview-prep" rel="noopener noreferrer"&gt;ReactGrind's React interview questions page&lt;/a&gt; is organized the same way — by topic and difficulty, from beginner controlled-inputs questions up to a dedicated FAANG set on things like why &lt;code&gt;useEffect&lt;/code&gt; runs twice in Strict Mode.&lt;/p&gt;

&lt;h2&gt;
  
  
  The takeaway
&lt;/h2&gt;

&lt;p&gt;If "MERN stack" is on your resume, all four letters need to hold up under questioning, not just the R. Spend an evening specifically hunting for your weakest layer instead of doing another React refresher you probably don't need as badly as you think.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>mern</category>
      <category>react</category>
      <category>node</category>
    </item>
    <item>
      <title>Why You Still Fumble useEffect After 2 Years of React</title>
      <dc:creator>Gautam</dc:creator>
      <pubDate>Sat, 08 Aug 2026 15:43:07 +0000</pubDate>
      <link>https://dev.to/gautam_f015817a44372df414/why-you-still-fumble-useeffect-after-2-years-of-react-5b28</link>
      <guid>https://dev.to/gautam_f015817a44372df414/why-you-still-fumble-useeffect-after-2-years-of-react-5b28</guid>
      <description>&lt;p&gt;You know what &lt;code&gt;useEffect&lt;/code&gt; does. You could explain the dependency array to a junior dev in your sleep. And yet — be honest — the last time you wrote one under any kind of pressure (a live coding round, a tight deadline, someone watching over your shoulder), did it come out clean on the first try?&lt;/p&gt;

&lt;p&gt;If not, you're not bad at React. You've just never actually &lt;em&gt;practiced&lt;/em&gt; it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Knowing ≠ doing
&lt;/h2&gt;

&lt;p&gt;This distinction sounds obvious once you say it out loud, but almost nobody applies it to how they learn React. We read the docs, we watch a tutorial, we nod along — and we quietly assume that comprehension is the same thing as skill.&lt;/p&gt;

&lt;p&gt;It isn't. A musician doesn't get good at scales by reading about scales. An athlete doesn't get fast by watching game film alone. Skill comes from repetition under feedback — attempt, get corrected, attempt again. Most React learning skips the "attempt" part entirely and goes straight from "read" to "assume I've got it."&lt;/p&gt;

&lt;h2&gt;
  
  
  The specific gap: hooks
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8osfysx68ahwmo9sdx61.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8osfysx68ahwmo9sdx61.png" alt="React coding challenge" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hooks are where this gap shows up hardest, because they &lt;em&gt;look&lt;/em&gt; simple. &lt;code&gt;useState&lt;/code&gt; is one line. &lt;code&gt;useEffect&lt;/code&gt; is a function and an array. It's easy to read a hook's signature, feel like you understand it, and never actually hit the edge cases that only show up when you're the one writing the code:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Forgetting a cleanup function until you've got three intervals stacking on top of each other&lt;/li&gt;
&lt;li&gt;Mutating an array in state and wondering why nothing re-renders&lt;/li&gt;
&lt;li&gt;A stale closure inside an effect that's technically "working" but silently reading last render's value&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of these show up when you're reading someone else's correct code. They only show up when you write it yourself, get it subtly wrong, and have something tell you so.&lt;/p&gt;

&lt;h2&gt;
  
  
  A dumb-simple fix: the 3x3 drill
&lt;/h2&gt;

&lt;p&gt;Here's a structure that actually works, borrowed straight from how deliberate practice works in any other skill:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pick &lt;strong&gt;three hooks&lt;/strong&gt; for the week.&lt;/li&gt;
&lt;li&gt;For each one, do &lt;strong&gt;three challenges&lt;/strong&gt; — one easy, one medium, one hard.&lt;/li&gt;
&lt;li&gt;Timebox each attempt. If you don't pass on the first try, don't peek at a solution immediately — rewrite it from scratch after you've sat with the failure for a bit.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A rough progression that works well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Week 1 — useState, useReducer, useEffect
Week 2 — useRef, useMemo, useCallback
Week 3 — useContext, useLayoutEffect, useSyncExternalStore
Week 4 — Custom hooks: useDebounce, useInterval, usePrevious
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Four weeks, 45 minutes a session, three sessions a week. That's it. That's the whole system.&lt;/p&gt;

&lt;h2&gt;
  
  
  What "correct" actually means here
&lt;/h2&gt;

&lt;p&gt;The hard part isn't finding hook exercises — the internet is full of them. The hard part is knowing whether your solution is &lt;em&gt;actually&lt;/em&gt; correct, not just "looks right to me." A written answer key can't catch a missing cleanup function or a mutated array — those bugs are silent until something breaks in a way you didn't predict.&lt;/p&gt;

&lt;p&gt;What catches them is a real test suite mounting your component and interacting with it the way a user actually would — clicking fast, unmounting mid-effect, passing edge-case props. That's a fundamentally different (and much more honest) kind of feedback than eyeballing your own code.&lt;/p&gt;

&lt;p&gt;I've been going through exactly this drill myself, hook by hook, using &lt;a href="https://reactgrind.com/blog/react-hooks-exercises-practice-guide" rel="noopener noreferrer"&gt;ReactGrind's hooks practice guide&lt;/a&gt; — it lays out the mental model and the common mistake for each hook, then links to an actual coding challenge with hidden tests for each one. It's the first resource I've found that treats "I understand this hook" and "I can write this hook correctly under pressure" as the two different things they actually are.&lt;/p&gt;

&lt;h2&gt;
  
  
  The takeaway
&lt;/h2&gt;

&lt;p&gt;If you've been meaning to get sharper on hooks, skip another article that just explains what they do. You already know what they do. Go write ten of them badly this week, get told exactly where they broke, and rewrite them. That's the whole unlock.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe5p25ex5u1e3kuptev6z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe5p25ex5u1e3kuptev6z.png" alt="ReactGrind - Practice React" width="799" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to jump straight in without reading a whole guide first, &lt;a href="https://reactgrind.com/problems" rel="noopener noreferrer"&gt;ReactGrind's full problem set&lt;/a&gt; is where the actual challenges live — hooks, state management, performance, the works, each one graded by a hidden test suite instead of an answer key.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>AI Can Write Your React Code. It Still Can't Tell You Why It's Wrong.</title>
      <dc:creator>Gautam</dc:creator>
      <pubDate>Thu, 16 Jul 2026 07:17:00 +0000</pubDate>
      <link>https://dev.to/gautam_f015817a44372df414/ai-can-write-your-react-code-it-still-cant-tell-you-why-its-wrong-19oc</link>
      <guid>https://dev.to/gautam_f015817a44372df414/ai-can-write-your-react-code-it-still-cant-tell-you-why-its-wrong-19oc</guid>
      <description>&lt;p&gt;Every few months there's a new wave of "AI just made developers obsolete" takes, and every few months React developers specifically get singled out as the easiest to replace — "it's just JSX and hooks, the model's seen a million examples of that." I've been building with React for a while now, and I've been using AI tools daily for just as long. Here's the actual gap nobody talks about, and it's not the one you'd expect.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI is genuinely great at the part everyone worries about
&lt;/h2&gt;

&lt;p&gt;Ask any decent model to write a &lt;strong&gt;&lt;code&gt;useDebounce&lt;/code&gt;&lt;/strong&gt; hook, a controlled form, a memoized list — it'll produce something that looks right, compiles, and probably works for the happy path. That part of the fear is legitimate. The boilerplate-to-competent-code gap has basically closed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part it's still bad at: telling you &lt;strong&gt;why&lt;/strong&gt; your version is wrong
&lt;/h2&gt;

&lt;p&gt;Here's the thing that doesn't show up in demos. AI-generated code looks confident regardless of whether it's actually correct. It'll happily hand you a &lt;code&gt;useEffect&lt;/code&gt; with a subtly wrong dependency array, a debounce hook that breaks on rapid unmount, a memoized callback that isn't actually stable — and it'll explain the code with the same confident tone whether the explanation is right or completely made up.&lt;/p&gt;

&lt;p&gt;The failure mode isn't "AI can't write React." It's "AI can't reliably tell you when &lt;strong&gt;your&lt;/strong&gt; React is broken, and it can't force you to confront the gap between code that looks plausible and code that's actually correct under real conditions."&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this matters more for React specifically than people think
&lt;/h2&gt;

&lt;p&gt;React bugs are rarely syntax errors. They're timing bugs, stale closures, unstable references causing silent re-renders, cleanup functions that don't run when you assumed they would. None of that shows up by reading the code. It shows up when the code actually runs against real interaction — fast clicks, rapid typing, a component unmounting mid-effect.&lt;/p&gt;

&lt;p&gt;An AI model reading your code can miss all of that, the same way a human skimming a pull request can. The only thing that reliably catches it is running the code against real conditions and checking the actual behavior, not the code's appearance.&lt;/p&gt;

&lt;h2&gt;
  
  
  So what's actually changing for developers
&lt;/h2&gt;

&lt;p&gt;Not "will AI replace you." The real shift is: the value of &lt;em&gt;writing&lt;/em&gt; boilerplate correctly is dropping fast, while the value of &lt;em&gt;knowing whether code is actually correct&lt;/em&gt; — being able to reason about edge cases, verify behavior, and catch what an AI-generated confident explanation glossed over — is going up. If your entire skill was typing out a &lt;code&gt;useEffect&lt;/code&gt; from memory, that's genuinely less valuable now. If your skill is knowing that a debounce hook needs to survive an unmount mid-timer and being able to verify that it does, that's more valuable than ever, because it's exactly the thing AI output doesn't reliably self-check.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practically, this means practicing differently
&lt;/h2&gt;

&lt;p&gt;Reading AI-generated React code and nodding along teaches you nothing about whether you could catch the same bug yourself. The instinct that actually matters — spotting a stale closure, knowing when a dependency array is wrong, recognizing an unstable reference — only builds by writing code yourself and getting real, immediate feedback on whether it's actually correct, not whether it looks correct.&lt;/p&gt;

&lt;p&gt;This is part of why I built &lt;strong&gt;&lt;a href="https://www.reactgrind.com" rel="noopener noreferrer"&gt;ReactGrind&lt;/a&gt;&lt;/strong&gt; — React-specific coding challenges checked by real automated test suites instead of a written answer key. The whole point is closing that exact gap: you write the component, real tests mount it and interact with it the way a user actually would, and you find out immediately whether it holds up — not whether it merely resembles a correct answer.&lt;/p&gt;

&lt;p&gt;AI can write plausible React code all day. Practicing against real tests is still how you build the instinct to know the difference.&lt;/p&gt;




&lt;p&gt;Curious what others are seeing here — has your day-to-day debugging shifted at all now that AI writes a bigger share of first-draft code? What's actually catching the bugs for you these days?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>I built a LeetCode-style platform, but for only for React (not DSA)</title>
      <dc:creator>Gautam</dc:creator>
      <pubDate>Tue, 14 Jul 2026 23:15:10 +0000</pubDate>
      <link>https://dev.to/gautam_f015817a44372df414/i-built-a-leetcode-style-platform-but-for-only-for-react-not-dsa-1ccj</link>
      <guid>https://dev.to/gautam_f015817a44372df414/i-built-a-leetcode-style-platform-but-for-only-for-react-not-dsa-1ccj</guid>
      <description>&lt;p&gt;If you've ever prepped for a &lt;strong&gt;frontend interview&lt;/strong&gt;, you've probably hit this weird gap: LeetCode will happily grill you on binary trees and dynamic programming, but it has almost nothing to say about the thing you'll actually be asked to build in a real frontend interview — a debounced search box, a modal that traps focus correctly, a component that doesn't quietly re-render itself into a performance problem.&lt;/p&gt;

&lt;p&gt;That gap is why I built &lt;a href="https://www.reactgrind.com/" rel="noopener noreferrer"&gt;ReactGrind&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz2gydny4roxo8pdfynxq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz2gydny4roxo8pdfynxq.png" alt="React Coding Challenges" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What ReactGrind actually is?
&lt;/h2&gt;

&lt;p&gt;ReactGrind is a coding practice platform built specifically around React — not algorithms, not data structures, just the actual behavior of React itself: hooks, rendering, state, effects, memoization, and the kind of edge cases that only show up once real user interaction is involved.&lt;/p&gt;

&lt;p&gt;Every challenge comes with a real automated test suite, not a static answer key. You write a component, hit run, and the tests mount it, click it, type into it, and check the result — the same way a real pull request gets reviewed before it ships. If it passes, you know it actually works. If it fails, you know exactly where.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's on there right now
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnkcewpem42qvt5iw33mw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnkcewpem42qvt5iw33mw.png" alt="Practice React Online - ReactGrind" width="799" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.reactgrind.com/problems" rel="noopener noreferrer"&gt;50+ problems&lt;/a&gt;&lt;/strong&gt; (adding questions daily) across Hooks &amp;amp; State, Custom Hooks, Performance, Context &amp;amp; Patterns, Forms &amp;amp; Events, and a FAANG-style Interview Set&lt;br&gt;
A React Interview Prep section — 200+ questions with plain-English explanations, analogies, and code examples, not just one-line definitions&lt;br&gt;
A free online React compiler/playground — no signup, no setup, just write and run React code instantly in the browser&lt;br&gt;
A blog covering practical React engineering topics — React 19's actual production impact, MERN stack interview prep, and things like whether React counts as frontend or backend (yes, people really do ask that)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why test-based practice, specifically?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp2bt8v4gs6799d3bil8x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fp2bt8v4gs6799d3bil8x.png" alt="React coding challenges - ReactGrind" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Writing a debounced search box is easy. Writing one that still works when someone types fast, deletes everything mid-debounce, or unmounts the component while a timer is pending — that's the part that actually gets caught in code review, and it's the part a written answer key can't check for you. A real test suite catches it immediately, which is a much better habit to build than comparing your code to someone else's "correct" solution and hoping it's equivalent.&lt;/p&gt;

&lt;p&gt;If you're prepping for a &lt;strong&gt;frontend role&lt;/strong&gt;, or you just want to stay sharp on React outside of whatever you're building at work, it's free to start: reactgrind.com&lt;/p&gt;

&lt;p&gt;Since this is early and actively evolving — if you try it and something feels off, missing, or like it should exist but doesn't, I'd genuinely like to hear it. Bug reports, feature ideas, "this problem's test cases are wrong," all of it is useful right now.&lt;/p&gt;

</description>
      <category>react</category>
      <category>mern</category>
      <category>leetcode</category>
      <category>java</category>
    </item>
    <item>
      <title>10 React Hooks Interview Questions That Actually Trip People Up (With Explanations)</title>
      <dc:creator>Gautam</dc:creator>
      <pubDate>Sun, 12 Jul 2026 12:42:05 +0000</pubDate>
      <link>https://dev.to/gautam_f015817a44372df414/10-react-hooks-interview-questions-that-actually-trip-people-up-with-explanations-2d3g</link>
      <guid>https://dev.to/gautam_f015817a44372df414/10-react-hooks-interview-questions-that-actually-trip-people-up-with-explanations-2d3g</guid>
      <description>&lt;p&gt;If you've been prepping for &lt;strong&gt;React interviews&lt;/strong&gt;, you've probably noticed most &lt;em&gt;interview question&lt;/em&gt; lists online are either too basic (what is useState) or copy-pasted from the same five articles. So I put together a list of &lt;strong&gt;hooks questions&lt;/strong&gt; that come up often in real interviews — the kind that sound simple but expose whether you actually understand what's happening under the hood.&lt;/p&gt;

&lt;p&gt;Let's go through them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why does this useEffect cause an infinite loop?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Answer: No &lt;strong&gt;dependency array&lt;/strong&gt; means the effect runs after every render.&lt;br&gt;
Since it updates state on every run, it triggers another render, which&lt;br&gt;
triggers the effect again — forever. Add &lt;strong&gt;[]&lt;/strong&gt; if you want it to run once, or a proper dependency array if it should run on specific value changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's the difference between useMemo and useCallback?
&lt;/h2&gt;

&lt;p&gt;Both cache something between renders, but:&lt;/p&gt;

&lt;p&gt;**useMemo **caches a value (the result of a computation)&lt;br&gt;
**useCallback **caches a function reference&lt;/p&gt;

&lt;p&gt;A common gotcha: useCallback(fn, deps) is literally equivalent to&lt;br&gt;
useMemo(() =&amp;gt; fn, deps). If you understand that, you understand both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why does my state update not reflect immediately after setState?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Aman&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handleClick&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;setName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;New Name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// still logs "Aman"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Answer: State updates are **asynchronous **and batched. name inside&lt;br&gt;
handleClick is a snapshot from the current render's closure — it won't&lt;br&gt;
reflect the update until the component re-renders.&lt;/p&gt;

&lt;h2&gt;
  
  
  What problem does **useRef **solve that **useState **can't?
&lt;/h2&gt;

&lt;p&gt;useRef gives you a mutable object that persists across renders without&lt;br&gt;
triggering a re-render when it changes. Great for:&lt;/p&gt;

&lt;p&gt;Storing a DOM node reference&lt;br&gt;
Keeping a mutable value (like a timer ID) that shouldn't cause a re-render&lt;/p&gt;

&lt;h2&gt;
  
  
  Why do &lt;strong&gt;custom hooks&lt;/strong&gt; need to start with "use"?
&lt;/h2&gt;

&lt;p&gt;It's not just convention — it's how React's linter (and React itself) knows to apply the Rules of Hooks (no conditional calls, no calls inside loops) to your custom hook. Name it getSomething instead of useSomething and &lt;strong&gt;ESLint's&lt;/strong&gt; hooks plugin won't catch violations inside it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's a stale closure, and how does it happen with hooks?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;interval&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;setInterval&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// always logs the initial value&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;clearInterval&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;interval&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Answer: The effect's closure captures count from the render it was&lt;br&gt;
created in. With an empty dependency array, that closure never updates —&lt;br&gt;
so count is frozen at its initial value forever inside the interval.&lt;/p&gt;

&lt;h2&gt;
  
  
  When would you use &lt;strong&gt;useLayoutEffect **instead of **useEffect&lt;/strong&gt;?
&lt;/h2&gt;

&lt;p&gt;Answer: useLayoutEffect runs synchronously before the browser paints. Use it when you need to measure or mutate the DOM before the user sees anything (e.g., preventing a visual flicker when adjusting an element's position). useEffect runs after paint, which is fine for most side effects (data fetching, subscriptions).&lt;/p&gt;

&lt;h2&gt;
  
  
  Can you conditionally call a hook?
&lt;/h2&gt;

&lt;p&gt;No — and interviewers love asking why, not just that. React tracks hooks&lt;br&gt;
by call order per render, not by name. If a hook is skipped in one render&lt;br&gt;
and called in another, the entire hook-state mapping shifts, causing bugs&lt;br&gt;
that are hard to trace.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does the dependency array in &lt;strong&gt;useEffect&lt;/strong&gt; actually compare?
&lt;/h2&gt;

&lt;p&gt;Shallow equality (Object.is), not deep equality. This is why passing an&lt;br&gt;
object or array literal as a dependency causes the effect to run on every&lt;br&gt;
render — a new reference is created every time, even if the contents are&lt;br&gt;
identical.&lt;/p&gt;

&lt;h2&gt;
  
  
  How would you **debounce **a search input using hooks?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;useDebounce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;debounced&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setDebounced&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;timer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setDebounced&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;clearTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;timer&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;debounced&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;cleanup function&lt;/strong&gt; is the key part — it cancels the previous timer&lt;br&gt;
whenever value changes before the delay finishes, so only the last&lt;br&gt;
keystroke actually triggers the debounced update.&lt;/p&gt;

&lt;p&gt;If you want to test yourself on questions like these interactively (with&lt;br&gt;
instant feedback instead of just reading answers), I've been building&lt;br&gt;
&lt;a href="//www.reactgrind.com"&gt;ReactGrind &lt;/a&gt; — a LeetCode-style platform specifically&lt;br&gt;
for React.js practice. Still actively adding new challenges, so &lt;strong&gt;feedback&lt;/strong&gt; is very welcome if you try it out.&lt;/p&gt;

&lt;p&gt;What's a hooks question that stumped you in an interview? Drop it in the&lt;br&gt;
comments — might turn it into a follow-up post.&lt;/p&gt;

</description>
      <category>career</category>
      <category>interview</category>
      <category>javascript</category>
      <category>react</category>
    </item>
  </channel>
</rss>
