<?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 Rejoy on Medium]]></title>
        <description><![CDATA[Stories by Rejoy on Medium]]></description>
        <link>https://medium.com/@rejoykulangara?source=rss-e97eae1c94a5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*11wDJhcF2Fp5lrFu</url>
            <title>Stories by Rejoy on Medium</title>
            <link>https://medium.com/@rejoykulangara?source=rss-e97eae1c94a5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 15:32:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rejoykulangara/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[Bridging LSP and LLMs: Smarter Code Intelligence]]></title>
            <link>https://medium.com/@rejoykulangara/bridging-lsp-and-llms-smarter-code-intelligence-917c2c1c9c50?source=rss-e97eae1c94a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/917c2c1c9c50</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[lsp]]></category>
            <dc:creator><![CDATA[Rejoy]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 10:11:45 GMT</pubDate>
            <atom:updated>2026-08-19T10:11:45.079Z</atom:updated>
            <content:encoded><![CDATA[<p>How <strong>lsp-mcp-server</strong> gives LLMs instant semantic code intelligence — cutting exploration cost by <strong>6×</strong> and freeing your context window for real work.</p><p>Every time you ask an AI assistant to help with your codebase, something quietly expensive happens before it writes a single line of code. It reads files. Then it reads the files those files reference. Then maybe a few more.</p><p>By the time it’s ready to actually help you, a large slice of its context window is already gone — consumed by <em>exploration</em>, not execution.</p><p>This isn’t a bug. It’s the unavoidable consequence of an LLM having no semantic model of your code. It processes text brilliantly — but it has no live type information, no call graph, no symbol index. Every conversation starts from zero.</p><p>There’s a better way. And it’s been sitting inside every IDE for decades.</p><h3>The Problem: Context Windows Eaten by Exploration</h3><p>Imagine asking Claude: <em>“Add error handling to the API client.”</em> Before it can write anything useful, it needs to understand the codebase. Here’s what actually happens — token by token:</p><ul><li><strong>Read the full API client file</strong> — ~800 tokens</li><li><strong>Read request/response type definitions</strong> — ~600 tokens</li><li><strong>Read the error types file</strong> — ~400 tokens</li><li><strong>Scan for existing error handling patterns</strong> — ~1,000 tokens</li><li><strong>Find where the client is used</strong> — ~1,500 tokens</li></ul><blockquote><strong><em>Total exploration cost: ~4,300 tokens</em></strong> — before a single line of code is written.</blockquote><p>In a moderately complex codebase this number grows fast. And it compounds across a long session — eventually squeezing out conversation history, earlier decisions, and the coherence that makes AI help useful.</p><blockquote>The deeper problem: the more complex your codebase, the less context remains for actual work. The AI spends its budget reading, not reasoning.</blockquote><h3>The Insight: Language Servers Already Know Everything</h3><p>Your IDE knows, instantly and precisely, where a function is defined, what type an expression resolves to, where every reference to a symbol lives, and whether your code has type errors. It doesn’t scan files for this — it queries a Language Server.</p><p>The Language Server Protocol (LSP) is the standard behind VS Code’s IntelliSense, JetBrains’ inspections, Eclipse’s LSP4E integration, and Neovim’s completion. Battle‑tested. Language‑aware. The product of decades of compiler engineering. Eclipse and IntelliJ both rely on dedicated LSP adapters — <strong>LSP4J</strong>, <strong>LSP4E</strong>, <strong>LSP4IJ</strong>, and <strong>LSP4Jakarta</strong> — to expose compiler‑level semantics. On top of these, <strong>Liberty Tools for Eclipse</strong>, <strong>Liberty Tools for IntelliJ</strong>, and <strong>Liberty Tools for VS Code</strong> extend LSP for Jakarta EE and MicroProfile productivity.</p><p><strong>lsp-mcp-server</strong> bridges this protocol into the <strong>Model Context Protocol (MCP)</strong>, giving LLMs like Claude direct, structured access to LSP capabilities. Instead of reading files to infer meaning, the AI simply asks the language server.</p><pre>Claude (MCP)  ──▶  lsp-mcp-server  ──▶  Language Servers<br>Claude (MCP)  ◀──  lsp-mcp-server  ◀──  (TS / Python / Go / Rust / …)</pre><p>Language servers start automatically on first request, restart on crash, and idle-shutdown when not needed. Eight languages are supported out of the box.</p><h3>The Impact: 6× More Context for Real Work</h3><p>Same task — <em>“Add error handling to the API client”</em> — with LSP access:</p><ul><li><strong>lsp_document_symbols</strong> — structured outline of the client — ~150 tokens</li><li><strong>lsp_hover</strong> on key methods for type signatures — ~200 tokens</li><li><strong>lsp_find_references</strong> to see usage patterns — ~250 tokens</li><li><strong>lsp_diagnostics</strong> to check for existing issues — ~100 tokens</li></ul><blockquote><strong><em>Total exploration cost: ~700 tokens.</em></strong> That’s a 6× reduction — and the context saved compounds across every task in the session.</blockquote><p>6× more context for reasoning</p><p>84% reduction in exploration tokens</p><p>compounds across long sessions</p><h3>Six Concrete Benefits</h3><h3>1 — Confident answers without exhaustive exploration</h3><p>Without LSP, when asked “what type does getUserProfile return?&quot;, the AI faces a losing choice: read multiple files (~500–2,000 tokens), guess from naming conventions (risky), or hedge with &quot;I&#39;d need to see the implementation&quot; (useless).</p><p>With lsp_hover, it gets the complete, compiler-verified type signature in ~100 tokens. No guessing. No hedging.</p><h3>2 — Surgical navigation of unfamiliar codebases</h3><p>Onboarding to a new project typically means reading the entire src/ directory to build a mental map. With LSP, exploration becomes targeted:</p><ul><li>lsp_workspace_symbols — find key classes by name</li><li>lsp_type_hierarchy — map inheritance relationships</li><li>lsp_call_hierarchy — trace execution flow</li><li>lsp_document_symbols — understand a file&#39;s structure without reading every line</li></ul><h3>3 — Safe refactoring with guaranteed completeness</h3><p>Text search misses aliased references and re-exports. lsp_rename with dry_run: true produces a complete, scope-aware list of every change needed — the same logic your IDE uses. Review, confirm, apply. Correctness guaranteed.</p><h3>4 — Definitive impact analysis</h3><p>“If I change this interface, what breaks?” Without LSP this requires scanning potentially hundreds of files. With lsp_find_references and lsp_find_implementations, the AI answers definitively:</p><blockquote>“This function is called from 7 locations across 4 files. Here they are.”</blockquote><h3>5 — Type-aware code generation</h3><p>Without semantic information, generated code guesses property names from context. It works often — until it silently doesn’t, and you’re debugging a runtime error that a type-aware tool would have caught instantly.</p><p>With lsp_hover and lsp_completions, generated code is <strong>correct by construction</strong>, not by coincidence.</p><h3>6 — Reduced hallucination through ground truth</h3><p>LLMs sometimes state things confidently that aren’t true — a function that doesn’t exist, a type signature that’s slightly wrong. LSP provides verifiable ground truth. The AI shifts from <em>“I believe X”</em> to <em>“the language server confirms X.”</em></p><h3>The 19 Tools at a Glance</h3><p><strong>Navigation</strong></p><ul><li>lsp_goto_definition — exact file + line for any symbol</li><li>lsp_goto_type_definition — jump to the type of an expression</li></ul><p><strong>References &amp; Relationships</strong></p><ul><li>lsp_find_references — every usage across the codebase</li><li>lsp_find_implementations — all classes implementing an interface</li><li>lsp_call_hierarchy — full call graph, callers and callees</li><li>lsp_type_hierarchy — inheritance and subtype relationships</li></ul><p><strong>Information</strong></p><ul><li>lsp_hover — full type signature and docs, no file read needed</li><li>lsp_signature_help — parameter hints while generating calls</li><li>lsp_completions — available members for a type</li></ul><p><strong>Symbols</strong></p><ul><li>lsp_document_symbols — file outline without full content</li><li>lsp_workspace_symbols — find any class or function by name</li></ul><p><strong>Refactoring &amp; Diagnostics</strong></p><ul><li>lsp_rename — scope-aware rename with dry-run preview</li><li>lsp_code_actions — suggested fixes and refactors</li><li>lsp_format_document — language-aware formatting</li><li>lsp_diagnostics — compiler errors without running a build</li></ul><p><strong>Combined &amp; Management</strong></p><ul><li>lsp_smart_search — unified semantic search</li><li>lsp_server_status, lsp_start_server, lsp_stop_server — lifecycle control</li></ul><h3>Supported Languages</h3><p>Java / TypeScript / JavaScript / Python / Rust / Go / C / C++ / Ruby / PHP / Elixir</p><h3>The Bigger Idea</h3><p>LLMs are powerful reasoning engines. Language servers are powerful semantic analysers. They’ve been operating in isolation — one in chat windows, the other embedded in editors — even though they’re solving complementary halves of the same problem.</p><p><strong>lsp-mcp-server</strong> closes that gap. The LLM handles what it’s good at — reasoning, synthesis, generation. The language server handles what it’s good at — symbol resolution, type inference, scope analysis.</p><blockquote>The result isn’t just faster AI — it’s <strong><em>more accurate AI</em></strong>. Fewer hallucinations. More confident answers. Changes that are correct by construction. And a context window that stays focused on the work that actually matters.</blockquote><p>Your LLM already knows how to reason about code. Now give it the tools to actually <em>see</em> it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=917c2c1c9c50" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Reliable Job Queues with Valkey / Redis and Node.js]]></title>
            <link>https://medium.com/@rejoykulangara/building-reliable-job-queues-with-valkey-redis-and-node-js-935f574c3d3d?source=rss-e97eae1c94a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/935f574c3d3d</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[queue]]></category>
            <category><![CDATA[kafka]]></category>
            <dc:creator><![CDATA[Rejoy]]></dc:creator>
            <pubDate>Wed, 22 Oct 2025 09:05:49 GMT</pubDate>
            <atom:updated>2025-10-22T09:12:08.634Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Managing multiple job types across clusters doesn’t have to be chaotic — meet Valkey, the open-source Redis alternative that makes queueing almost too easy.</em></p><p>🧩 The Setup</p><p>Let’s picture a web dashboard — built in <strong>React</strong> — showing the status of various jobs:<br> ✅ Running jobs<br> ✅ Completed jobs<br> ✅ Queued jobs waiting for their turn</p><p>Each job triggers a <strong>shell or Python script</strong> in the backend, orchestrated through <strong>Node.js</strong> in the middle.</p><p>Now here’s the rule of the land:</p><ul><li><strong>Jobs of the same type cannot overlap</strong> — because they run in the same container and might compete for the same resources.</li><li><strong>Jobs of different types</strong> can happily run together — they use different clusters or stacks, so no interference.</li></ul><p>This means if a job of a particular type is already running, the next one of that same type must <strong>wait patiently.</strong></p><h3>Example Tech Stack</h3><ul><li>React : UI dashboard for starting/canceling jobs</li><li>Node.js : Queue logic, cron, and orchestration</li><li>Shell &amp; Python scripts : Heavy job processing</li><li>Valkey (Redis-open source) : Manages job queues efficiently</li></ul><h3>Wait — Redis as a Queue?</h3><p>Most developers know Redis as a <em>cache</em> — “store data in memory for faster access.”<br> But Redis (and Valkey) can do more than caching — it’s also brilliant for <strong>queueing</strong>.</p><p>You can push tasks into a list, pop them later, and even handle retries or prioritisation.</p><p>Before jumping into implementation, let’s discuss <em>why</em> Redis/Valkey fits</p><h4>The Requirements</h4><p>We needed:</p><ul><li><strong>Instant push/pop operations</strong></li><li><strong>Concurrency control</strong></li><li><strong>Seamless Node.js integration</strong></li><li>Is <strong>lightweight and open-source</strong></li></ul><h4>Why Redis / Valkey Wins</h4><p>When it comes to managing background jobs, there are a few familiar names that usually pop up</p><p><strong>Kafka</strong> is amazing for high-throughput data streaming. But complex for single job control, Kafka feels like bringing a bulldozer to move a chair — powerful, but overkill.</p><p><strong>RabbitMQ</strong> is a strong too. However, its heavy configuration and slower message throughput can make simple job control unnecessarily complex.</p><p><strong>Celery</strong> and <strong>BullMQ</strong> are popular task managers, but they often require adopting new frameworks or adding multiple layers to your stack.</p><h3>Meet Valkey: Open, Fast, and Enterprise-Backed</h3><p>Valkey emerged in 2024 when Redis changed its license. The open-source community — led by <strong>IBM </strong>and others — came together to keep a truly open alternative alive.</p><p>Valkey continues from Redis 7.2.4 and maintains full protocol compatibility, so it’s a <strong>drop-in replacement</strong> for Redis.</p><h3>Example Use Case: Smart Queues for Job Types</h3><p>Here’s how a <strong>multi-type job queue system</strong> looks conceptually using Valkey and Node.js:</p><ol><li>🏷️ Each <strong>job type</strong> has its own queue in Valkey.</li><li>🧩 When a new job request comes from the UI</li></ol><ul><li>Node.js checks if a job of that type is <strong>currently running</strong>.</li><li>If yes → add it to that type’s <strong>Valkey queue</strong>.</li><li>If no → start it immediately.</li></ul><p>3. ⏱️ A Node.js <strong>cron job</strong> runs every 15 minutes:</p><ul><li>It checks each queue.</li><li>If a queue’s job type isn’t running, it pops the next job and triggers it</li></ul><p>4. ❌ <strong>Cancel use cases</strong>:</p><ul><li><strong>Cancel running job:</strong> identifies the shell process and all its child processes, then kills them gracefully.</li><li><strong>Cancel queued job:</strong> simply removes (pops) that job from the Valkey queue.</li></ul><p>Each job type runs safely, one at a time, while other job types continue in parallel — smooth and efficient!</p><h3>Implementation Example (Node.js + Valkey)</h3><h4>1️⃣ Install Packages</h4><pre>npm install redis node-cron</pre><h4>2️⃣ Connect to Valkey</h4><pre>import { createClient } from &#39;redis&#39;;<br><br>const client = createClient({ url: &#39;redis://localhost:6379&#39; });<br>await client.connect();</pre><h4>3️⃣ Handle Job Requests</h4><pre>async function handleJobRequest(type, jobData) {<br>  const isRunning = await checkIfJobRunning(type);<br>if (isRunning) {<br>    await client.rPush(`queue:${type}`, JSON.stringify(jobData));<br>    console.log(`Queued job of type ${type}`);<br>  } else {<br>    startJob(type, jobData);<br>  }<br>}</pre><h4>4️⃣ Start and Manage Jobs</h4><pre>async function startJob(type, jobData) {<br>  markJobAsRunning(type);<br>  await runBackendScript(jobData); // shell or python execution<br>  markJobAsCompleted(type);<br>}</pre><h4>5️⃣ Periodic Queue Processor</h4><pre>import cron from &#39;node-cron&#39;;<br><br>cron.schedule(&#39;*/15 * * * *&#39;, async () =&gt; {<br>  const jobTypes = [&#39;TYPE_A&#39;, &#39;TYPE_B&#39;, &#39;TYPE_C&#39;];<br>  for (const type of jobTypes) {<br>    const isRunning = await checkIfJobRunning(type);<br>    if (!isRunning) {<br>      const nextJob = await client.lPop(`queue:${type}`);<br>      if (nextJob) {<br>        const jobData = JSON.parse(nextJob);<br>        startJob(type, jobData);<br>      }<br>    }<br>  }<br>});</pre><h4>6️⃣ Cancelling Queued Jobs</h4><pre>async function cancelQueuedJob(type, jobId) {<br>  const queue = await client.lRange(`queue:${type}`, 0, -1);<br>  for (const job of queue) {<br>    const parsed = JSON.parse(job);<br>    if (parsed.id === jobId) {<br>      await client.lRem(`queue:${type}`, 1, job);<br>      console.log(`Cancelled queued job: ${jobId}`);<br>    }<br>  }<br>}</pre><h3>Why This Setup</h3><p><strong>Simple yet powerful</strong> — No Kafka or heavy brokers needed<br> <strong>Type-based queues</strong> — Maintain clean concurrency per container<br> <strong>Instant push/pop</strong> — Valkey lists make it lightning-fast<br> <strong>Cron-driven orchestration</strong> — Fully automated<br> <strong>Cancel support</strong> — Full lifecycle control from UI</p><h3>Conclusion</h3><p>Valkey + Node.js gives you a <strong>lightweight, open-source</strong>, and <strong>production-friendly</strong> job management system — no enterprise licenses, no over-engineered setups.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=935f574c3d3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The useEffect is Overused: Meet the New Hooks You Should Be Using]]></title>
            <link>https://medium.com/@rejoykulangara/the-useeffect-is-overused-meet-the-new-hooks-you-should-be-using-22f355777df8?source=rss-e97eae1c94a5------2</link>
            <guid isPermaLink="false">https://medium.com/p/22f355777df8</guid>
            <dc:creator><![CDATA[Rejoy]]></dc:creator>
            <pubDate>Sun, 13 Apr 2025 15:14:23 GMT</pubDate>
            <atom:updated>2025-04-13T15:24:30.070Z</atom:updated>
            <content:encoded><![CDATA[<p>React Hooks revolutionised the way we build components by enabling function-based components to manage state and side effects. Before hooks, class components were the only way to leverage lifecycle methods and internal state, leading to verbose code and tricky patterns like binding methods or managing this.</p><p><strong>Functional components + Hooks = Simpler, cleaner, and more reusable logic.</strong></p><p>With hooks, we can break logic into reusable units, easily test side-effects, and avoid deeply nested class hierarchies. Hooks encourage declarative programming and have made React development more approachable and expressive.</p><h3>Why Functional Components with Hooks Are Better Than Classes</h3><ul><li><strong>Less boilerplate</strong>: No need to bind this or use constructors</li><li><strong>Better separation of concerns</strong>: Logic can be split into custom hooks</li><li><strong>Cleaner syntax</strong>: Functions are easier to read and write than classes</li><li><strong>Improved reusability</strong>: Extracting logic into hooks is straightforward</li><li><strong>Better testing and maintainability</strong>: Smaller, focused units of logic</li></ul><p>That said, one hook often gets overused, especially by developers transitioning from class-based lifecycle methods: useEffect.</p><h3>The Hidden Cost of Overusing useEffect</h3><p>Let’s start with a typical snippet:</p><pre>useEffect(() =&gt; {<br>  fetchData().then(setData);<br>}, []);</pre><p>Seems fine. But what’s wrong here?</p><ol><li><strong>Unclear responsibility</strong>: useEffect handles both side-effects and state updates, which makes testing and separation of concerns harder.</li><li><strong>Implicit lifecycle</strong>: Effects don’t run during server-side rendering. Async logic within useEffect isn&#39;t cancelable by default.</li><li><strong>Double invocation</strong>: With React 18’s Strict Mode in development, effects run twice. If you’re not careful, that means duplicated API calls.</li></ol><p>Let’s explore <strong>multiple scenarios where useEffect</strong> <strong>is either ineffective or avoidable</strong>:</p><h4>1. Deriving state from props or other state</h4><pre>useEffect(() =&gt; {<br>  setFullName(`${firstName} ${lastName}`);<br>}, [firstName, lastName]);</pre><p>Instead:</p><pre>const fullName = `${firstName} ${lastName}`;</pre><h4>2. Using useEffact just to compute derived values</h4><pre>useEffect(() =&gt; {<br>  const filtered = items.filter(item =&gt; item.active);<br>  setFiltered(filtered);<br>}, [items]);</pre><p>Instead:</p><pre>const filtered = useMemo(() =&gt; items.filter(item =&gt; item.active), [items]);</pre><h4>3. Synchronising state that could be computed directly</h4><pre>useEffect(() =&gt; {<br>  if (count &gt; 10) setWarning(true);<br>  else setWarning(false);<br>}, [count]);</pre><p>Instead:</p><pre>const warning = count &gt; 10;</pre><p>useEffect adds unnecessary indirection in all these cases.</p><h3>What to Use Instead</h3><p>Modern React encourages using specialised hooks like useMemo, useCallback, useRef, and useLayoutEffect for better semantics and performance. Let&#39;s break them down.</p><h3>useMemo: Derive State Declaratively</h3><pre>const sortedItems = useMemo(() =&gt; {<br>  return [...items].sort((a, b) =&gt; a.value - b.value);<br>}, [items]);</pre><p><strong>When to use it</strong>: Avoid recalculating expensive computations unless dependencies change.</p><p><strong>Why it’s better</strong>: You’re expressing a derived value <em>declaratively</em>, without triggering extra re-renders or storing intermediate state.</p><h3>useCallback: Stable Function References</h3><pre>const handleClick = useCallback(() =&gt; {<br>  console.log(&#39;Clicked&#39;);<br>}, []);</pre><p><strong>When to use it</strong>: When passing functions to child components that rely on React.Memo, or to avoid re-creating handlers in performance-critical components.</p><p><strong>Why it matters</strong>: Changing function references can break memoization and cause unnecessary rendering of children.</p><h3>useRef: Persistent, Mutable State Without Re-renders</h3><p>Instead of tracking values via useEffect, use useRef:</p><pre>const previousValue = useRef(value);</pre><pre>useEffect(() =&gt; {<br>  if (previousValue.current !== value) {<br>    console.log(&#39;Value changed&#39;);<br>    previousValue.current = value;<br>  }<br>}, [value]);</pre><p>Better yet, in some cases, skip the effect entirely:</p><pre>const ref = useRef(initialValue);<br>ref.current = updatedValue;</pre><p><strong>Use it when</strong>: You need to persist values across renders without triggering an update cycle (e.g., scroll position, timers, previous props).</p><h3>useLayoutEffect: For Layout-Sensitive Work</h3><pre>useLayoutEffect(() =&gt; {<br>  const height = ref.current.getBoundingClientRect().height;<br>  setHeight(height);<br>}, []);</pre><p><strong>When to use it</strong>: If you need to measure DOM layout or force style changes before the browser paints.</p><p><strong>Caution</strong>: It blocks painting and can hurt performance. Use it <em>only</em> when truly needed.</p><h3>Refactoring Example: Deriving Instead of Storing</h3><h4>Before (state duplication):</h4><pre>useEffect(() =&gt; {<br>  const filtered = data.filter(item =&gt; item.active);<br>  setFilteredData(filtered);<br>}, [data]);</pre><h4>After (declarative computation):</h4><pre>const filteredData = useMemo(() =&gt; {<br>  return data.filter(item =&gt; item.active);<br>}, [data]);</pre><p>This reduces complexity by removing unnecessary state and lifecycle logic.</p><h3>When Should You Use useEffect?</h3><p>useEffect is still essential for side-effects that can&#39;t be expressed declaratively:</p><ul><li>Fetching data on mount</li><li>Subscribing to external APIs or sockets</li><li>Adding/removing event listeners</li><li>Synchronising with browser APIs (e.g., localStorage)</li></ul><p>But use it with intention:</p><ul><li>Keep logic minimal</li><li>Use cleanup functions</li><li>Avoid setting state if the component is unmounted</li></ul><h3>Conclusion</h3><p>React is a declarative library — your components should describe <em>what</em> should happen, not <em>how</em>. Overusing useEffect often indicates that we’re slipping back into imperative thinking.</p><p>Modern hooks like useMemo, useCallback, and useRef allow us to express logic more clearly, without unnecessary side-effects or complexity. Treat useEffect as a <strong>last resort</strong>—not a default.</p><p>By refactoring thoughtfully, you’ll build components that are easier to read, easier to test, and more predictable in behavior.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22f355777df8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>