<?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 Ajiththika Sivathas on Medium]]></title>
        <description><![CDATA[Stories by Ajiththika Sivathas on Medium]]></description>
        <link>https://medium.com/@ajiththika17?source=rss-7187b4057ddc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tsdtyg2ehOJF-6bTsBbPLw.jpeg</url>
            <title>Stories by Ajiththika Sivathas on Medium</title>
            <link>https://medium.com/@ajiththika17?source=rss-7187b4057ddc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 15:35:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ajiththika17/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[The Real Purpose of "use client" in Next.js]]></title>
            <link>https://medium.com/@ajiththika17/the-real-purpose-of-use-client-in-next-js-2170d8d6b40c?source=rss-7187b4057ddc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2170d8d6b40c</guid>
            <dc:creator><![CDATA[Ajiththika Sivathas]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 04:00:14 GMT</pubDate>
            <atom:updated>2026-03-11T04:01:09.895Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vSK9yc5hZ5nJkAP33oHrdg.png" /></figure><p>If you started using <strong>Next.js</strong>, you probably ran into this strange little line sitting at the top of some files:</p><pre>&quot;use client&quot;;</pre><p>And your brain immediately asked a few reasonable questions:</p><ul><li>Why is this string just floating here?</li><li>Why does React suddenly look like it’s casting spells?</li><li>And why does everything break when you remove it?</li></ul><p>Welcome to the world of <strong>React Server Components</strong>, where things run on the server, the browser, or both, and where one tiny line can completely change how your code behaves.</p><p>Let’s unpack what &quot;use client&quot; actually does, when you should use it, and why slapping it everywhere is one of the fastest ways to ruin your Next.js performance.</p><h3>First, Understand the Big Change in Next.js</h3><p>Before the App Router existed, React components mostly ran in the <strong>browser</strong>.</p><p>Your page loaded like this:</p><ol><li>Browser downloads JavaScript</li><li>React runs in the browser</li><li>React renders the UI</li></ol><p>Simple. But not very efficient. Modern Next.js flipped the model.</p><p>Now components are <strong>server components by default</strong>.<br>That means:</p><ul><li>The component runs <strong>on the server</strong></li><li>HTML gets generated <strong>before reaching the browser</strong></li><li>The browser receives <strong>less JavaScript</strong></li></ul><p>This dramatically improves performance. But it also introduces a limitation. Server components <strong>cannot use browser-only features</strong>. And that’s exactly why &quot;use client&quot; exists.</p><h3>What &quot;use client&quot; Actually Means</h3><p>The directive simply tells Next.js: <strong><em>“This component must run in the browser.” </em></strong>Without it, Next.js assumes the component should run on the <strong>server</strong>.</p><p>Here’s a simple example.</p><pre>&quot;use client&quot;;</pre><pre>import { useState } from &quot;react&quot;;<br>export default function Counter() {<br>  const [count, setCount] = useState(0);<br>  return (<br>    &lt;button onClick={() =&gt; setCount(count + 1)}&gt;<br>      Count: {count}<br>    &lt;/button&gt;<br>  );<br>}</pre><p>Why is &quot;use client&quot; required here? Because useState only works in <strong>client-side React</strong>. If you remove the directive, Next.js throws an error faster than your linter judging your variable names.</p><h3>What Server Components Are Good At</h3><p>Server components shine when rendering <strong>static or data-heavy UI</strong>.</p><p>Examples include:</p><ul><li>Blog articles</li><li>Product pages</li><li>Dashboards pulling database data</li><li>Documentation pages</li></ul><p>Because the rendering happens on the server, the browser receives <strong>plain HTML instead of heavy JavaScript</strong>.</p><p>That means:</p><ul><li>Faster page loads</li><li>Smaller bundles</li><li>Better SEO</li><li>Less client-side work</li></ul><p>In other words, the browser can relax for once.</p><h3>What Client Components Are For</h3><p>Client components exist for one main reason: <strong>Interactivity. </strong>If the user needs to interact with something, the component must run in the browser.</p><p>Examples include:</p><ul><li>Buttons</li><li>Forms</li><li>Dropdown menus</li><li>Modals</li><li>Drag-and-drop interfaces</li><li>Tabs</li><li>Interactive charts</li></ul><p>Basically, anything involving:</p><ul><li>useState</li><li>useEffect</li><li>event handlers</li><li>browser APIs</li></ul><p>needs &quot;use client&quot;</p><h3>The Mistake Everyone Makes</h3><p>Here’s what many developers do after discovering &quot;use client&quot;.<br>They panic and write this in every component:</p><pre>&quot;use client&quot;;</pre><p>Everywhere. Every file. Every component. <br>Congratulations. You just turned Next.js back into <strong>regular React with extra steps</strong>.</p><p>You lose the performance advantage because now everything runs in the browser again.</p><p>Which means:</p><ul><li>bigger JavaScript bundles</li><li>slower loading</li><li>unnecessary hydration</li></ul><p>This defeats the entire purpose of server components.</p><h3>A Better Architecture</h3><p>Instead of marking everything as client-side, split responsibilities.</p><p>Example page structure:</p><pre>ArticlePage (Server)<br> ├── ArticleContent (Server)<br> ├── AuthorCard (Server)<br> ├── CommentsList (Server)<br> └── CommentForm (Client)</pre><p>The only interactive piece is the <strong>CommentForm</strong>, so that’s the only component that needs &quot;use client&quot;. This keeps JavaScript minimal while still supporting interaction. Think of it as <strong>surgical use of client components</strong>.</p><h3>Another Important Detail</h3><p>When you add &quot;use client&quot; to a file, it affects <strong>the entire module</strong>. Everything inside becomes client-side.</p><p>Example:</p><pre>&quot;use client&quot;;</pre><pre>import Profile from &quot;./Profile&quot;;<br>import Settings from &quot;./Settings&quot;;</pre><p>Now Profile and Settings will run on the client too. That means you should place &quot;use client&quot; only in <strong>small, focused components</strong>, not large layout files. Otherwise, you accidentally push huge sections of your app into the browser.</p><h3>A Simple Rule to Remember</h3><p>When deciding whether to use &quot;use client&quot;, ask yourself one question: <strong>Does this component need the browser to function? </strong>If the answer is <strong>no</strong>, keep it as a server component. If the answer is <strong>yes</strong>, add &quot;use client&quot;. That’s it.</p><h3>Why This Design Is Actually Brilliant</h3><p>At first, this system feels annoying. But it solves one of the biggest problems in modern web development: <strong>Too much JavaScript.</strong></p><p>Most websites ship ridiculous amounts of client-side code that the browser has to download, parse, and execute. Server components reduce that drastically. The browser only runs JavaScript <strong>where interaction actually exists</strong>. Which is exactly how web architecture should work.</p><h3>Final Thoughts</h3><p>&quot;use client&quot; is not a React feature you sprinkle everywhere. It’s a <strong>boundary marker</strong>. It tells Next.js where the browser’s responsibility begins.</p><p>Used correctly, it gives you:</p><ul><li>faster apps</li><li>smaller bundles</li><li>better performance</li><li>cleaner architecture</li></ul><p>Used incorrectly, it turns your fancy Next.js app into a slow React bundle with extra configuration. So treat &quot;use client&quot; like salt in cooking. A little improves everything. Too much ruins the entire dish.</p><p>If you’re diving deeper into Next.js, the next concepts worth learning are:</p><ul><li><strong>Server Components architecture</strong></li><li><strong>Streaming and Suspense</strong></li><li><strong>Server Actions</strong></li><li><strong>Partial hydration</strong></li></ul><p>That’s where Next.js starts feeling less like React… and more like the future of web frameworks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2170d8d6b40c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How SEO Helps People Find Your Website on Google]]></title>
            <link>https://medium.com/@ajiththika17/how-seo-helps-people-find-your-website-on-google-42fc27bb1b5a?source=rss-7187b4057ddc------2</link>
            <guid isPermaLink="false">https://medium.com/p/42fc27bb1b5a</guid>
            <dc:creator><![CDATA[Ajiththika Sivathas]]></dc:creator>
            <pubDate>Tue, 10 Mar 2026 02:59:43 GMT</pubDate>
            <atom:updated>2026-03-10T02:59:43.657Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*SnhjmFMMCE07uLWtGvTKsA.png" /></figure><p>You built a website. Maybe it’s a blog, a portfolio, or the next billion-dollar startup idea. You hit publish and wait for visitors to pour in. And then… silence.</p><p>No traffic. No readers. Just you, your website, and the uncomfortable realization that <strong>Google doesn’t magically care about your site. </strong>This is the moment most people discover <strong>SEO</strong>.</p><p>SEO, or <strong>Search Engine Optimization</strong>, is basically the art of making sure your website <strong>shows up when people search on Google</strong>, instead of being buried somewhere on page 47 where only archaeologists might find it.</p><p>Let’s break down how SEO actually helps people find your website.</p><h4>The Internet Is Crowded (Ridiculously Crowded)</h4><p>Now imagine opening that coffee shop in a city with <strong>millions of other coffee shops</strong> and zero signs pointing to yours. That’s exactly what launching a website without SEO looks like.</p><p>There are <strong>billions of web pages</strong> online. Every time someone searches on Google, the search engine has to decide <strong>which pages deserve to appear first</strong>.</p><p>SEO helps your website send the right signals so Google knows:</p><ul><li>What your page is about</li><li>Who should see it</li><li>Why it deserves to rank</li></ul><p>Without those signals, your website might exist… but it’s basically invisible.</p><h4>SEO Helps Google Understand Your Content</h4><p>Google uses automated programs called <strong>crawlers</strong> to scan websites.</p><p>These crawlers analyze things like:</p><ul><li>Page titles</li><li>Headings</li><li>Keywords</li><li>Links</li><li>Content structure</li></ul><p>If your page clearly explains its topic Google can categorize it properly. For example, if someone searches: <strong>“how to learn web development”<br></strong>Google will show pages that clearly talk about <strong>learning web development</strong>.</p><p>If your article title is something vague like: <strong>“Random Thoughts About Coding” </strong>Google won’t know what to do with it. Your page becomes confusing for search engines.</p><p>SEO fixes that by making your content <strong>clear, structured, and searchable</strong>.</p><h4>SEO Connects You With What People Are Already Searching</h4><p>Here’s a simple truth many beginners miss. People are already searching for answers.</p><p>Millions of searches happen every day like:</p><ul><li>“explain Machine Learning”</li><li>“best laptops for programming”</li><li>“how to learn JavaScript fast”</li></ul><p>SEO is about <strong>aligning your content with these searches</strong>. Instead of guessing what people might want, you create content based on <strong>real search demand</strong>. Think of it like fishing in a lake full of fish instead of throwing a fishing line into your bathtub.</p><h4>Ranking Higher Means Getting Clicks</h4><p>Most users click one of the <strong>top results on Google</strong>. Very few people scroll far. And almost nobody goes to page two.</p><p>Being on page two of Google is like opening a store <strong>behind a locked door inside another store</strong>. Technically it exists, but nobody is walking in.</p><p>SEO improves rankings by optimizing things such as:</p><ul><li>Keywords in your content</li><li>Page titles</li><li>Meta descriptions</li><li>Website speed</li><li>Mobile friendliness</li><li>Internal links</li></ul><p>These improvements help Google see your website as <strong>relevant and useful</strong>, which increases your chances of ranking higher.</p><h4>SEO Builds Authority Over Time</h4><p>Google also evaluates <strong>credibility</strong>. If your website consistently publishes helpful content, it slowly gains authority.</p><p>A few things help build that authority:</p><p><strong>High Quality Content<br></strong>Content that actually answers questions instead of just repeating keywords.</p><p><strong>Backlinks<br></strong>When other websites link to your pages Google interprets that as a vote of confidence.</p><p><strong>Good User Experience<br></strong>Fast loading pages, clear layout, and easy navigation. The better the experience for users the better your reputation becomes in Google’s eyes.</p><h4>SEO Brings Long Term Traffic</h4><p>One of the biggest advantages of SEO is <strong>sustainable traffic</strong>. Paid ads stop working the moment you stop paying. SEO content can bring visitors <strong>for years</strong>.</p><p>A well written article can attract thousands of readers long after it was published. In other words, SEO is like planting trees. You do the work now and the results keep growing over time.</p><h4>The Reality About SEO</h4><p>SEO is not a magic trick. It won’t send millions of visitors overnight. But it does something far more valuable. It helps your website <strong>earn visibility</strong>.</p><p>When done correctly, SEO turns Google into a steady source of visitors who are actively searching for what you offer. And that’s far better than begging your friends to visit your website just to make the analytics graph look less depressing.</p><h4>Final Thoughts</h4><p>Creating a website is easy. Getting people to <strong>discover it</strong> is the real challenge. SEO solves that problem by connecting your content with the millions of people searching on Google every day.</p><p>So if your website currently feels like a hidden treasure nobody can find, SEO is the map that leads people straight to it. And trust me your analytics dashboard will thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42fc27bb1b5a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate Backend with Frontend Using Axios]]></title>
            <link>https://medium.com/@ajiththika17/integrate-backend-with-frontend-using-axios-6ed2bc85b9b7?source=rss-7187b4057ddc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ed2bc85b9b7</guid>
            <dc:creator><![CDATA[Ajiththika Sivathas]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 04:40:04 GMT</pubDate>
            <atom:updated>2026-03-09T04:40:04.460Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4gdXUbWiHdGrSXMaZtldqg.png" /></figure><p>A frontend without a backend is basically a beautiful lie. Buttons click, forms submit, loaders spin… but nothing actually happens. Real web applications work because the <strong>frontend talks to the backend</strong>. Data is fetched, stored, updated and returned. That communication usually happens through <strong>HTTP requests</strong> and one of the cleanest ways to handle them in JavaScript is <strong>Axios</strong>.</p><p>In this guide, you’ll learn how to integrate a backend with a frontend using Axios in a practical step-by-step way.</p><h4>What is Axios?</h4><p>Axios is a <strong>promise based HTTP client</strong> for JavaScript that allows your frontend to communicate with APIs. In simple terms Axios sends requests from your frontend to the backend and returns the response.</p><p>Developers use Axios because it provides:</p><ul><li>simple request syntax</li><li>automatic JSON handling</li><li>better error handling than fetch</li><li>request and response interceptors</li><li>easier configuration for APIs</li></ul><p>You could use fetch() but Axios often keeps things cleaner once your project grows beyond a few API calls.</p><h4>How Frontend and Backend Communicate</h4><p>Here’s the basic flow:</p><ol><li>A user performs an action on the frontend</li><li>The frontend sends a request using Axios</li><li>The backend processes the request</li><li>The backend returns data</li><li>The frontend updates the UI</li></ol><p>That’s the entire integration pipeline.</p><h4>Step 1: Create a Backend API</h4><p>For this example we’ll use <strong>Node.js with Express</strong>.</p><p>Install dependencies:</p><pre>npm init -y<br>npm install express cors</pre><p>Create server.js:</p><pre>const express = require(&quot;express&quot;);<br>const cors = require(&quot;cors&quot;);</pre><pre>const app = express();<br>app.use(cors());<br>app.use(express.json());<br>const users = [<br>  { id: 1, name: &quot;Alice&quot; },<br>  { id: 2, name: &quot;Bob&quot; }<br>];<br>app.get(&quot;/api/users&quot;, (req, res) =&gt; {<br>  res.json(users);<br>});<br>app.post(&quot;/api/users&quot;, (req, res) =&gt; {<br>  const newUser = {<br>    id: users.length + 1,<br>    name: req.body.name<br>  };<br>  users.push(newUser);<br>  res.status(201).json(newUser);<br>});<br>app.listen(5000, () =&gt; console.log(&quot;Server running on port 5000&quot;));</pre><p>This backend now exposes two endpoints:</p><ul><li>GET /api/users</li><li>POST /api/users</li></ul><h4>Step 2: Install Axios in the Frontend</h4><p>Inside your frontend project:</p><pre>npm install axios</pre><p>Now Axios can be used anywhere in your app.</p><h4>Step 3: Fetch Data with Axios (GET Request)</h4><p>Example React component:</p><pre>import axios from &quot;axios&quot;;<br>import { useEffect, useState } from &quot;react&quot;;</pre><pre>function Users() {<br>  const [users, setUsers] = useState([]);<br>  useEffect(() =&gt; {<br>    axios.get(&quot;http://localhost:5000/api/users&quot;)<br>      .then(res =&gt; setUsers(res.data))<br>      .catch(err =&gt; console.log(err));<br>  }, []);<br>  return (<br>    &lt;div&gt;<br>      &lt;h2&gt;User List&lt;/h2&gt;<br>      {users.map(user =&gt; (<br>        &lt;p key={user.id}&gt;{user.name}&lt;/p&gt;<br>      ))}<br>    &lt;/div&gt;<br>  );<br>}<br>export default Users;</pre><p>Axios sends a request, receives data and updates the UI. That’s your first frontend to backend connection.</p><h4>Step 4: Send Data with Axios (POST Request)</h4><p>Fetching data is common. Sending data is where real applications start.</p><pre>import axios from &quot;axios&quot;;<br>import { useState } from &quot;react&quot;;</pre><pre>function AddUser() {<br>  const [name, setName] = useState(&quot;&quot;);<br>  const handleSubmit = async (e) =&gt; {<br>    e.preventDefault();<br>    await axios.post(&quot;http://localhost:5000/api/users&quot;, {<br>      name: name<br>    });<br>    setName(&quot;&quot;);<br>  };<br>  return (<br>    &lt;form onSubmit={handleSubmit}&gt;<br>      &lt;input<br>        value={name}<br>        onChange={(e) =&gt; setName(e.target.value)}<br>        placeholder=&quot;Enter name&quot;<br>      /&gt;<br>      &lt;button type=&quot;submit&quot;&gt;Add User&lt;/button&gt;<br>    &lt;/form&gt;<br>  );<br>}</pre><p>This sends a JSON payload to the backend and creates a new user.</p><h4>Step 5: Create a Reusable Axios Instance</h4><p>Hardcoding API URLs everywhere quickly becomes messy. A better approach is creating an <strong>Axios instance</strong>. <br>Create api.js:</p><pre>import axios from &quot;axios&quot;;</pre><pre>const api = axios.create({<br>  baseURL: &quot;http://localhost:5000/api&quot;,<br>  headers: {<br>    &quot;Content-Type&quot;: &quot;application/json&quot;<br>  }<br>});<br>export default api;</pre><p>Now requests become cleaner:</p><pre>import api from &quot;./api&quot;;</pre><pre>api.get(&quot;/users&quot;);<br>api.post(&quot;/users&quot;, { name: &quot;John&quot; });</pre><p>This keeps API configuration in one place.</p><h4>Step 6: Handle Errors Properly</h4><p>Ignoring errors is a common beginner mistake. <br>Basic Axios error handling:</p><pre>try {<br>  const response = await api.get(&quot;/users&quot;);<br>  console.log(response.data);<br>} catch (error) {<br>  if (error.response) {<br>    console.log(error.response.status);<br>  } else {<br>    console.log(error.message);<br>  }<br>}</pre><p>This helps identify whether the issue is:</p><ul><li>server error</li><li>network error</li><li>bad request</li></ul><h4>Step 7: Handle CORS Issues</h4><p>When frontend and backend run on different ports, browsers block requests unless CORS is enabled.</p><p>Example:</p><p><strong>Frontend</strong></p><pre>localhost:3000</pre><p><strong>Backend</strong></p><pre>localhost:5000</pre><p>Enable CORS in Express:</p><pre>const cors = require(&quot;cors&quot;);</pre><pre>app.use(cors({<br>  origin: &quot;http://localhost:3000&quot;<br>}));</pre><p>Without this Axios requests will fail.</p><h4>Step 8: Organize API Calls in Service Files</h4><p>Large apps should not place API logic inside components.<br>Example userService.js:</p><pre>import api from &quot;./api&quot;;</pre><pre>export const getUsers = () =&gt; api.get(&quot;/users&quot;);<br>export const createUser = (data) =&gt; api.post(&quot;/users&quot;, data);</pre><p>Then use it in components:</p><pre>import { getUsers } from &quot;./userService&quot;;</pre><p>This keeps components focused on UI not network logic.</p><h4>Common Mistakes Developers Make</h4><p>These break Axios integrations more often than anything else:</p><ul><li>wrong API URL or port</li><li>backend server not running</li><li>CORS not configured</li><li>incorrect request body format</li><li>mixing API logic inside UI components</li><li>ignoring HTTP status codes</li></ul><p>Most Axios problems are actually configuration problems.</p><h4>Axios vs Fetch</h4><p>Both tools send HTTP requests.</p><p>Use <strong>Axios</strong> if you want:</p><ul><li>cleaner syntax</li><li>built-in JSON handling</li><li>interceptors</li><li>centralized configuration</li></ul><p>Use <strong>fetch</strong> if you want a minimal native solution. For medium to large apps, Axios usually becomes easier to manage.</p><h4>Final Thoughts</h4><p>Connecting frontend and backend is the core of any modern web application.</p><p>Axios simplifies this communication by giving you:</p><ul><li>clean request syntax</li><li>centralized API configuration</li><li>better error handling</li><li>scalable request management</li></ul><p>Set up your backend properly, structure your API calls well and Axios will handle the rest.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ed2bc85b9b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What I Understood From “Your Attitude Is Your Window to the World”]]></title>
            <link>https://medium.com/@ajiththika17/what-i-understood-from-your-attitude-is-your-window-to-the-world-6184660bd76d?source=rss-7187b4057ddc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6184660bd76d</guid>
            <dc:creator><![CDATA[Ajiththika Sivathas]]></dc:creator>
            <pubDate>Thu, 12 Feb 2026 04:44:16 GMT</pubDate>
            <atom:updated>2026-02-12T04:44:16.958Z</atom:updated>
            <content:encoded><![CDATA[<p>In this lesson, I read about two people sitting in the same restaurant. They ordered the same food and experienced the same environment. The service and the atmosphere were the same for both of them. But their behavior was completely different. One person stayed calm, smiled and enjoyed the moment. Even if there was a small delay, she remained patient. The other person complained, reacted negatively and focused only on what was wrong.</p><p>This example made me understand something important. The situation was not different. The environment was not different. The only difference was their mindset. One person chose to see the good side of the experience. The other chose to focus on the negative. Because of that their feelings and reactions became completely different.</p><p>This example made me understand something important. The situation was not different. The environment was not different. The only difference was their mindset. One person chose to see the good side of the experience. The other chose to focus on the negative. Because of that their feelings and reactions became completely different.</p><p>From this lesson, I learned that your mindset changes your life because how you think decides whether you feel happy or sad and how you handle everything around you. The positive person enjoyed the same place where the negative person felt irritated. That shows how powerful attitude really is.</p><p>I also understood that everything depends on our hands. We cannot control every small problem but we can control our reaction. Our behavior decides whether we create peace or tension around us.</p><p>This lesson clearly showed me that attitude is like a window. It changes how we see the world. If the window is clean everything looks better. If the window is dirty everything looks negative. The world may stay the same but our mindset changes the experience.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6184660bd76d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The 8 Application Server Protocols Every Developer Should Know]]></title>
            <link>https://medium.com/@ajiththika17/the-8-application-server-protocols-every-developer-should-know-96ffd8c17e3b?source=rss-7187b4057ddc------2</link>
            <guid isPermaLink="false">https://medium.com/p/96ffd8c17e3b</guid>
            <dc:creator><![CDATA[Ajiththika Sivathas]]></dc:creator>
            <pubDate>Tue, 03 Feb 2026 00:05:48 GMT</pubDate>
            <atom:updated>2026-02-03T00:09:24.811Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SlmoC8psoPuD29zgxDctag.png" /></figure><p>Picture this. You’re sitting in a technical interview. The interviewer leans forward and says, “So… tell me about application server protocols.” And your brain just… goes blank. We’ve all been there. Don’t worry — by the end of this post, that blank screen in your head is going to turn into something actually useful.</p><p>So what even ARE protocols? Think of them as the rules two computers agree on before they start talking. Without rules, it’s just chaos-like two people trying to have a conversation where one speaks English and the other speaks morse code. Protocols make sure everyone’s on the same page. And these 8? They’re the ones that actually matter.</p><h3>1. HTTP (HyperText Transfer Protocol)</h3><p>HTTP is the king of the internet. Every single time you open a website-any website-HTTP is the protocol making it happen. Here’s how it works: your browser sends a request to a server, and the server sends back a response. That’s it. You ask, it answers.</p><p>The one thing you need to remember about HTTP is that it’s <strong>stateless</strong>. That means after every single exchange, both sides forget each other completely. The server doesn’t remember you were just there a second ago. It’s like ordering coffee, getting your coffee, and then the barista immediately forgetting your face. Every new request is a brand new conversation.</p><p>HTTP is old, it’s not secure, and it’s not the fastest thing alive. But it is the foundation that everything else is built on top of. You can’t skip this one.</p><h3>2. HTTPS (HTTP Secure)</h3><p>HTTPS is just HTTP with a big security upgrade. The “S” stands for Secure, and it adds something called <strong>TLS encryption</strong> on top of regular HTTP. What that means in simple words? All the data travelling between your browser and the server is locked and hidden. Nobody can peek at it while it’s moving.</p><p>Why does this matter? Because without HTTPS, anyone sitting on the same Wi-Fi as you could literally read your passwords, your credit card numbers, everything. Google also ranks websites lower if they don’t use HTTPS, and browsers now show a warning if a site doesn’t have it. If you’re building a website, use HTTPS. No exceptions.</p><h3>3. WebSocket</h3><p>Here’s the problem with HTTP-it can only do one thing at a time. You send a request, you get a response, and then the connection closes. Every time you want new information, you have to start all over again. For regular websites, that’s fine. But what if you’re building a live chat app or an online game where messages need to fly back and forth in real time? HTTP would be way too slow for that.</p><p>That’s where WebSocket comes in. WebSocket opens a <strong>single connection</strong> between your browser and the server and keeps it open. Once it’s open, both sides can send and receive data at the same time, whenever they want, without waiting. Think of it like switching from sending letters back and forth to just picking up the phone and having a live conversation. If you’ve ever used a chat app where messages show up instantly, WebSocket is probably the reason why.</p><h3>4. gRPC (Google Remote Procedure Call)</h3><p>Imagine you have a big app that’s made up of lots of small, separate mini-apps, and all of them need to talk to each other all the time. That’s called microservices, and making them talk to each other fast is a real challenge. gRPC is Google’s solution to that problem.</p><p>The cool thing about gRPC is how it sends data. Instead of sending information as readable text like most things do, it uses something called <strong>Protocol Buffers</strong> which basically compresses the data into a tiny, super efficient package. It also runs on <strong>HTTP/2</strong>, which can handle many conversations at the same time over one connection. The result? Fast. Really fast. If speed between services matters to you, gRPC is the answer.</p><h3>5. AMQP (Advanced Message Queuing Protocol)</h3><p>Not everything on the internet needs to happen instantly. Sometimes your app just needs to say, “Hey, here’s a task-someone handle it whenever you’re free.” That’s exactly what AMQP does. It’s a <strong>messaging protocol</strong>, which means it lets apps send messages to each other through a middleman called a message broker.</p><p>Here’s the beautiful part-the person receiving the message doesn’t even need to be online when it’s sent. The message just sits in a queue and waits, patiently, until the other side is ready to pick it up. Think of it like dropping a letter in a mailbox. It doesn’t matter if the person isn’t home right now. The letter will be there when they are. This is how background tasks like sending emails, processing orders, and handling notifications work in big apps.</p><h3>6. MQTT (Message Queuing Telemetry Transport)</h3><p>MQTT is like AMQP’s smaller, lighter cousin. It does a similar job-sending messages between devices-but it’s designed for devices that don’t have a lot of power or a strong internet connection. We’re talking about things like smart home sensors, health monitors, or industrial machines.</p><p>The way it works is simple. A device <strong>publishes</strong> a message on a topic, like “kitchen temperature.” A broker receives it. And any other device that’s <strong>subscribed</strong> to that topic gets the message automatically. No extra data, no wasted energy, just tiny little messages moving exactly where they need to go. If you’ve ever used a smart thermostat or a fitness tracker that talks to your phone, MQTT was probably behind the scenes making that happen.</p><h3>7. FTP (File Transfer Protocol)</h3><p>FTP is one of the oldest protocols on the entire internet. Like, really old. And somehow, it’s still alive and kicking in a lot of places. Its job is incredibly simple-it lets you transfer files from one computer to another. You connect to a server, you log in, you upload or download files. That’s the whole thing.</p><p>The big problem with FTP? It sends everything-your username, your password, your files-completely out in the open with <strong>zero encryption</strong>. Anyone who’s watching the network can see all of it. That’s why today, most people use <strong>SFTP</strong> instead, which is basically FTP but with SSH encryption wrapped around it to keep everything safe. FTP is old school, it’s not secure on its own, but understanding how it works is still important, especially if you ever have to work with older systems.</p><h3>8. LDAP (Lightweight Directory Access Protocol)</h3><p>Have you ever logged into a school system or a company portal with just one username and password and suddenly had access to your email, your files, your projects-everything? That one login doing all that? That’s LDAP working behind the scenes.</p><p>LDAP is a protocol that talks to something called a <strong>directory service</strong>, which is basically a big organised database of users. It stores things like who you are, what team you’re on, what you’re allowed to access, and your email address. When you log in, the app uses LDAP to ask that database, “Is this person real? Are they allowed here? What can they see?” It’s not the flashiest protocol out there, but in any company or school with more than a few people, LDAP is quietly holding everything together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q9r-FA-N_IgG45vTlXRT6g.png" /></figure><h3>Bonus: The Protocols That Didn’t Make the Main List (But You’ll Still See Them Around)</h3><p>The internet is built on way more than 8 protocols. These ones didn’t make the main list, but they’re worth knowing about because you’re going to run into them sooner or later.</p><p><strong>SMTP (Simple Mail Transfer Protocol)-</strong>This is the protocol that actually delivers your emails. When you hit send, SMTP is the one picking up that email and carrying it from one mail server to another until it lands in someone’s inbox. Without SMTP, email simply doesn’t work.</p><p><strong>SSH (Secure Shell)-</strong>SSH lets developers remotely control a server from their own computer through a secure, encrypted connection. If you’ve ever seen someone type ssh in a terminal and suddenly be &quot;inside&quot; another machine, that&#39;s this. It&#39;s like a secret tunnel between two computers.</p><p><strong>DNS (Domain Name System)-</strong>DNS is the internet’s phone book. When you type google.com, your computer has no idea what that means. DNS translates that name into an IP address-the actual number address where Google&#39;s server lives — so your computer knows where to go. Without DNS, you&#39;d have to memorise numbers for every single website.</p><p><strong>WebRTC (Web Real-Time Communication)-</strong>This is the reason video calls and voice chats work right inside your browser without downloading any extra software. It lets two devices talk directly to each other-sending audio and video back and forth in real time. Zoom alternatives and Google Meet both rely on it.</p><p><strong>SOAP (Simple Object Access Protocol)-</strong>SOAP is an older, more strict way for apps to communicate. It uses XML to package up data, and it’s very formal and very structured. Big companies like banks still use it because it’s super reliable and has strong security rules built right in.</p><p><strong>GraphQL-</strong>GraphQL is a newer way to ask a server for data. Instead of grabbing a whole chunk of information and throwing away what you don’t need, GraphQL lets you ask for exactly what you want-nothing more, nothing less. Facebook created it, and a lot of modern apps are switching to it because it makes things faster and cleaner.</p><h3>So Why Should You Actually Care About Any of This?</h3><p>Here’s the honest truth. As a web developer, you’re not going to use every single one of these protocols every day. But understanding how they work? That’s what separates someone who just builds websites from someone who actually understands how the internet works behind the scenes.</p><p>Protocols are the invisible roads that carry data across the internet. You can’t see them. You don’t think about them when you’re scrolling through Instagram or buying something on Amazon. But the second one of them breaks, everything stops. The developers who understand these protocols are the ones who can fix things fast, build things that actually work at scale, and-let’s be real here-impress people in interviews.</p><p>So don’t just skip this post. Come back to it. Bookmark it. And the next time someone mentions protocols in a meeting, you’ll actually know what they’re talking about. You’re welcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96ffd8c17e3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Netflix decide which movies are recommended to you]]></title>
            <link>https://medium.com/@ajiththika17/how-netflix-decide-which-movies-are-recommended-to-you-6d6c1a6aac7b?source=rss-7187b4057ddc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d6c1a6aac7b</guid>
            <dc:creator><![CDATA[Ajiththika Sivathas]]></dc:creator>
            <pubDate>Tue, 13 Jan 2026 04:21:11 GMT</pubDate>
            <atom:updated>2026-01-13T04:21:11.683Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*53iiJPCIWmLr5agx.jpg" /></figure><h3>The Algorithm Knows You Better Than Your Best Friend</h3><p>Ever wondered why Netflix keeps insisting you’d love that obscure Danish crime thriller? Or why it thinks watching one baking show means you’re ready for a 12-part docuseries about competitive cheese-making? Welcome to the wonderfully weird world of Netflix’s recommendation algorithm where your viewing habits are analyzed with more precision than a forensic investigation.</p><p>Let’s pull back the curtain on how Netflix decides what appears in your “Because You Watched” queue.</p><h3>The Secret Sauce: It’s All About the Data</h3><p>Netflix doesn’t just know what you watch-it knows <em>how</em> you watch. The streaming giant collects an almost comical amount of data about your viewing behavior:</p><p><strong>What Netflix tracks:</strong></p><ul><li>What you watch (obviously)</li><li>When you watch it</li><li>What device you’re using</li><li>Whether you pause, rewind, or fast-forward</li><li>When you stop watching (did you rage-quit after 10 minutes?)</li><li>What you add to your list but never actually watch</li><li>What you search for but don’t click on</li><li>Even what you hover over but skip</li></ul><p>That’s right-Netflix judges you for hovering over “Bridgerton” for three seconds before chickening out and watching “The Office” for the 47th time.</p><h3>The Three Pillars of Netflix Recommendations</h3><h4>1. Collaborative Filtering: “People Like You Also Enjoyed…”</h4><p>This is Netflix’s version of “your vibes match.” The algorithm finds users with similar viewing patterns to yours and recommends what they enjoyed that you haven’t seen yet.</p><p>Think of it as the world’s most sophisticated friend group. If you and 10,000 other people all loved “Stranger Things” and “Black Mirror,” but they also loved “Dark” and you haven’t watched it yet, Netflix will push “Dark” your way faster than you can say “algorithm.”</p><h4>2. Content-Based Filtering: Breaking Down Every Frame</h4><p>Netflix doesn’t just know a movie is a “thriller” it knows if it’s a “dark psychological thriller with a strong female lead, set in rural America, featuring slow-burn suspense and minimal dialogue.”</p><p>The company employs actual humans (called “taggers”) who watch content and assign hundreds of micro-genres and attributes. We’re talking categories so specific they border on absurd:</p><ul><li>“Emotional Movies About Friendship Based on Books”</li><li>“Quirky Crime Documentaries”</li><li>“Feel-Good British TV Shows”</li><li>“Cerebral Foreign Sci-Fi &amp; Fantasy”</li></ul><p>There are reportedly over 76,000 micro-genres in Netflix’s system. Yes, seventy-six thousand. Your weird taste isn’t that weird it’s just hyper-categorized.</p><h4>3. Personalized Ranking: The Ultimate Customization</h4><p>Here’s where it gets truly mind-bending: Netflix doesn’t show everyone the same homepage. Even if you and your roommate have separate profiles on the same account, your recommendations will be wildly different based on your individual behavior.</p><p>The algorithm considers:</p><ul><li>Time of day (late-night you has different taste than morning you)</li><li>Day of the week (Friday night vibes vs. Tuesday afternoon energy)</li><li>Your recent viewing patterns</li><li>Trending content in your region</li><li>Seasonal factors</li></ul><p>This is why Netflix thinks you want true crime documentaries at 11 PM but heartwarming comedies at Sunday breakfast.</p><h3>The Thumbnail Game: Yes, They’re Different for You</h3><p>Plot twist: Netflix also personalizes the artwork you see. That’s right, the thumbnail image for the same movie might look completely different for you than for someone else.</p><p>If you watch a lot of romance, you might see a thumbnail highlighting the couple. If you’re into action, you’ll see the explosion scene. If you’ve been watching a lot of a particular actor, their face mysteriously becomes more prominent in thumbnails for movies they’re in.</p><p>It’s like Netflix is running thousands of A/B tests simultaneously, and you’re the lab rat. But, like, a very entertained lab rat.</p><h3>The 80/20 Rule That Drives Everything</h3><p>Here’s Netflix’s dirty little secret: the algorithm’s goal isn’t just to show you good content, it’s to keep you watching. Period.</p><p>The company reportedly uses a metric called “effective catalog size,” which measures how much of their library actually gets watched. Their mission? Make sure you’re discovering content you’ll finish, not just start.</p><p>This is why Netflix sometimes recommends “safe” choices-things that fit perfectly into your established patterns-rather than challenging you with something completely different. The algorithm has learned that you’re more likely to finish something comfortably familiar than to take a risk on something totally new.</p><h3>Why Netflix Sometimes Gets It Hilariously Wrong</h3><p>Despite all this sophisticated technology, we’ve all experienced the recommendations that make zero sense:</p><p>Because you watched ‘The Crown’: Try ‘Fast &amp; Furious 7’</p><p>These fails usually happen because:</p><ul><li>You shared your account and now the algorithm thinks you have multiple personality disorder</li><li>You left something playing while you fell asleep</li><li>You watched one thing ironically and Netflix didn’t get the joke</li><li>The algorithm found a connection so obscure only a supercomputer would make it</li></ul><h3>The Autoplay Preview Assault</h3><p>Let’s address the elephant in the room: those autoplay previews that start blaring when you hover over a title for more than 1.5 seconds.</p><p>You might hate them, but Netflix’s data shows they work. People are more likely to watch something after seeing a preview. The algorithm has learned that movement catches attention, and attention drives engagement. It’s annoying, but it’s effective-kind of like commercials, except sneakier.</p><h3>What You Can Do to Train Your Algorithm</h3><p>Want better recommendations? Here’s how to teach Netflix what you actually like:</p><p><strong>Use the thumbs up/down buttons religiously.</strong> This is the most direct feedback you can give. Netflix weighs these ratings heavily.</p><p><strong>Remove things from your “Continue Watching” row.</strong> This tells Netflix you’re not interested in finishing something, which is valuable data.</p><p><strong>Create separate profiles.</strong> Stop sharing with your partner/kids/roommate. Your “Bluey” binges are ruining your “gritty crime drama” recommendations.</p><p><strong>Actually use “My List” strategically.</strong> What you add (and what you remove) tells Netflix about your intentions versus your actual viewing.</p><p><strong>Watch to completion.</strong> The algorithm notices if you consistently finish shows versus abandoning them halfway through.</p><h3>The Future: AI Gets Even Smarter</h3><p>Netflix is continuously evolving its recommendation system using machine learning and AI. Future developments might include:</p><ul><li>Analyzing audio and visual elements in real-time</li><li>Understanding emotional arcs and pacing preferences</li><li>Predicting what you’ll want to watch based on global events or trending topics</li><li>Even more personalized thumbnails and descriptions</li></ul><p>Some researchers are even exploring whether Netflix might eventually analyze your facial expressions through your device’s camera to gauge your real-time reactions. (Don’t worry, this isn’t happening yet-but the technology exists.)</p><h3>The Bottom Line</h3><p>Netflix’s recommendation algorithm is a masterpiece of data science, behavioral psychology, and good old-fashioned trial and error. It’s designed to keep you engaged, entertained, and scrolling — because every minute you spend on Netflix is a minute you’re not spending on Disney+, HBO Max, or (gasp) going outside.</p><p>Is it creepy that a streaming service knows your viewing habits better than you know yourself? Maybe. Is it also kind of amazing that you can sit down on a random Tuesday and immediately find something perfectly suited to your mood? Absolutely.</p><p>So the next time Netflix recommends something bizarrely specific to your tastes, remember: it’s not stalking, it’s statistics. Very, very detailed statistics.</p><p>Now if you’ll excuse me, I have a “Quirky Time-Travel Comedies with Strong Female Leads” recommendation to investigate.</p><p>#Netflix #StreamingTechnology #MachineLearning #Algorithms #Technology #Entertainment #DataScience #AI #ContentRecommendation #StreamingServices</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d6c1a6aac7b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why React Uses the Virtual DOM Instead of Touching the DOM Directly]]></title>
            <link>https://medium.com/@ajiththika17/why-react-uses-the-virtual-dom-instead-of-touching-the-dom-directly-0be9317fb133?source=rss-7187b4057ddc------2</link>
            <guid isPermaLink="false">https://medium.com/p/0be9317fb133</guid>
            <dc:creator><![CDATA[Ajiththika Sivathas]]></dc:creator>
            <pubDate>Tue, 30 Dec 2025 04:19:31 GMT</pubDate>
            <atom:updated>2025-12-30T04:21:54.202Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0UtgjXpVimDbzUED.gif" /></figure><p>Let’s get something out of the way.</p><p>If direct DOM manipulation were a good long-term strategy, React would never have been invented. Facebook did not wake up one morning and decide to complicate frontend development for fun.</p><p>The Virtual DOM exists because <strong>manual DOM updates fail quietly, then fail catastrophically</strong>.</p><p>Let’s talk about why.</p><h3>The DOM Is Not Slow. Your Usage of It Is.</h3><p>The browser DOM is not your enemy.<br>Your assumptions about how cheap it is to update are.</p><p>Every time you touch the DOM directly, the browser may need to:</p><ul><li>Recalculate styles</li><li>Recalculate layout</li><li>Repaint pixels</li><li>Reflow elements</li></ul><p>You do not control when this happens.<br>The browser does.</p><p>Do this occasionally and nothing breaks.<br>Do this repeatedly in a dynamic UI and performance slowly bleeds out.</p><p>No errors. No warnings. Just jank.</p><h3>Direct DOM Manipulation: Fine at First, Painful Forever</h3><p>Direct DOM manipulation feels productive early on.<br>Then the app grows, and everything gets weird.</p><h3>What Goes Wrong</h3><p>When you manipulate the DOM manually, you introduce problems that compound over time:</p><ul><li>Scattered state</li><li>UI changes happen in multiple places</li><li>No single source of truth</li><li>Hidden dependencies</li><li>One change breaks three unrelated features</li><li>Debugging nightmares</li><li>“Who changed this element and why?”</li></ul><p>This is not a skill issue.<br>This is an architectural dead end.</p><h3>Performance Death by a Thousand DOM Updates</h3><p>One DOM update is cheap.<br>A few hundred inside event handlers, animations, and async callbacks are not.</p><p>The browser does not optimize chaos.</p><p>Common mistakes include:</p><ul><li>Updating the DOM inside loops</li><li>Toggling classes repeatedly</li><li>Reading and writing layout properties back-to-back</li></ul><p>These issues do not show up in small demos.<br>They show up in real products, on real devices, used by real humans.</p><p>Usually the slow ones.</p><h3>Enter the Virtual DOM</h3><p>The Virtual DOM is not a replacement for the real DOM.<br>It is a <strong>strategy for controlling it</strong>.</p><p>What React actually does:</p><ul><li>Keeps a lightweight in-memory representation of the UI</li><li>Rebuilds it when state changes</li><li>Compares old and new versions</li><li>Updates only what actually changed</li></ul><p>The result:</p><ul><li>Fewer DOM writes</li><li>Batched updates</li><li>Predictable rendering behavior</li></ul><p>React does not eliminate DOM work.<br>It minimizes unnecessary DOM work.</p><p>That distinction matters.</p><h3>Important Correction: Virtual DOM Is Not “Faster”</h3><p>Let’s kill a popular myth.</p><p>The Virtual DOM itself is not faster than the real DOM.<br>If someone says that, stop listening.</p><p>What is faster:</p><ul><li>Fewer reflows</li><li>Fewer repaints</li><li>Smarter update scheduling</li></ul><p>React wins by reducing how often the browser does expensive work, not by replacing it with magic JavaScript.</p><h3>Declarative UI: The Real Reason React Wins</h3><p>Performance is nice.<br><strong>Predictability is better.</strong></p><p>With direct DOM manipulation, you tell the browser <em>how</em> to change the UI.</p><p>With React, you describe <em>what</em> the UI should look like for a given state.</p><p>This shift gives you:</p><ul><li>A single source of truth</li><li>Easier reasoning about UI</li><li>Fewer side effects</li><li>Less fragile code</li></ul><p>Instead of chasing bugs across event handlers, you trace state changes.</p><p>That alone justifies the Virtual DOM.</p><h3>When You Should Not Use React</h3><p>Let’s be practical.</p><p>React is unnecessary if you are:</p><ul><li>Building a simple static site</li><li>Adding minimal interactivity</li><li>Writing small, isolated widgets</li></ul><p>Using React everywhere is cargo cult engineering.</p><p>The Virtual DOM exists to solve <strong>complex, state-driven UI problems</strong>, not to replace basic JavaScript.</p><h3>Final Takeaways</h3><p>React uses the Virtual DOM because:</p><ul><li>Direct DOM manipulation does not scale</li><li>Performance problems appear silently</li><li>UI state becomes unmanageable</li><li>Debugging turns into archaeology</li></ul><p>The Virtual DOM is not about being clever.<br>It is about <strong>staying sane as applications grow</strong>.</p><p>If your app never grows, you do not need it.<br>If it does, you will eventually build something worse than React by accident.</p><p>React just made that mistake first and fixed it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0be9317fb133" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Essential Things to Consider When Converting HTML Template to React]]></title>
            <link>https://medium.com/@ajiththika17/essential-things-to-consider-when-converting-html-template-to-react-5a40177c984e?source=rss-7187b4057ddc------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a40177c984e</guid>
            <dc:creator><![CDATA[Ajiththika Sivathas]]></dc:creator>
            <pubDate>Fri, 19 Dec 2025 04:45:05 GMT</pubDate>
            <atom:updated>2025-12-19T04:45:05.455Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/760/0*5qRDweruJP59Wl0W.png" /></figure><p>Converting an HTML template into a React application is more than copying and pasting code. React introduces a component-based architecture, declarative rendering, and strict JSX syntax that require careful planning. To make the process smooth, here are the <strong>essential things to consider</strong>, presented in bullet form with concise explanations.</p><h3>Main Points to Consider</h3><p>• <strong>JSX Compliance and Syntax</strong><br>React uses JSX, which looks like HTML but follows JavaScript rules. Attributes like class become className, for becomes htmlFor, and all tags must be properly closed. This ensures predictable rendering and fewer runtime errors.</p><p>• <strong>Component-Based Architecture</strong><br>HTML templates are typically page-centric. In React, break your UI into reusable components like headers, navigation bars, cards, and footers. This improves maintainability, readability, and scalability.</p><p>• <strong>Declarative Event Handling</strong><br>Inline HTML events do not work in React. Use camelCase event handlers in your components and manage UI behavior through functions and state rather than direct DOM manipulation.</p><p>• <strong>State and Props Management</strong><br>Static HTML content should become dynamic. Use props to pass data between components and state to manage changes, enabling a scalable and interactive UI.</p><p>• <strong>Styling and Asset Organization</strong><br>Avoid relying on global CSS from HTML templates. Import styles and assets at the component level and use React-friendly libraries to prevent conflicts and maintain modularity.</p><p>• <strong>Avoid Direct DOM Manipulation</strong><br>Libraries like jQuery manipulate the DOM directly, which conflicts with React’s virtual DOM. Use state and props to manage UI updates instead of manual DOM changes.</p><p>• <strong>Project Structure and Maintainability</strong><br>Organize your project by separating components, pages, assets, and utilities. A clean structure improves collaboration, debugging, and aligns with industry best practices.</p><h3>Conclusion</h3><p>Converting an HTML template to React is a strategic process, not just a code migration. By focusing on JSX compliance, componentization, state management, and structured project organization, you can transform a static template into a modern, maintainable React application ready for production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a40177c984e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why JavaScript Uses Asynchronous Programming Even Though It’s Single-Threaded]]></title>
            <link>https://medium.com/@ajiththika17/why-javascript-uses-asynchronous-programming-even-though-its-single-threaded-1e9da2800de4?source=rss-7187b4057ddc------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e9da2800de4</guid>
            <dc:creator><![CDATA[Ajiththika Sivathas]]></dc:creator>
            <pubDate>Mon, 15 Dec 2025 04:36:43 GMT</pubDate>
            <atom:updated>2025-12-15T04:36:43.022Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FZFnpJqrHAvWqgH0H1vjqQ.png" /><figcaption>Asynchronous Programming</figcaption></figure><p>JavaScript is single-threaded, yet it handles thousands of things at the same time in a browser. This sounds confusing at first, especially for beginners. The reason JavaScript can do this is not that it breaks the single-threaded rule, but because it uses asynchronous programming very intelligently.</p><p>Before understanding asynchronous behavior, we must clearly understand what JavaScript is trying to protect and what problem it is solving.</p><h3>What Single-Threaded Actually Means</h3><ul><li>One call stack</li><li>One task executing at a time</li><li>No parallel execution inside the JavaScript engine</li></ul><p>Single-threaded means JavaScript has only one execution path. At any moment, only one function can run. This design choice keeps JavaScript simple and predictable. There is no chance that two functions change the same variable at the same time. This is extremely important for browser stability and developer sanity.</p><p>However, this design creates a serious problem when JavaScript meets slow operations.</p><h3>The Real Problem Blocking the Main Thread</h3><p>JavaScript runs inside the browser, and the browser must stay responsive. If JavaScript waits for a slow task like a network request, the entire page becomes unresponsive. Buttons stop working. Animations freeze. Users think the website is broken.</p><p>Blocking the single thread is unacceptable in a browser environment. JavaScript needed a way to start slow tasks without stopping execution.</p><p>This is exactly why asynchronous programming exists.</p><h3>Why Asynchronous Programming Is Necessary</h3><ul><li>Keeps UI responsive</li><li>Prevents blocking the call stack</li><li>Improves user experience</li></ul><p>Asynchronous programming allows JavaScript to start a task and move on immediately. The task runs somewhere else, and JavaScript is notified only when the task is finished. JavaScript does not wait. It continues executing other code.</p><p>This makes JavaScript feel fast, even though it is still single-threaded.</p><h3>Who Actually Handles the Asynchronous Work</h3><p>JavaScript itself does not perform asynchronous operations. The browser provides special features called Web APIs. These Web APIs handle time-based tasks, network requests, and events.</p><p>When JavaScript encounters something asynchronous, it hands it over to the browser. Once the task completes, the result is placed into a queue. JavaScript will only execute that result when the call stack is empty.</p><p>This delegation is the key idea behind JavaScript asynchronous behavior.</p><h3>Event Loop: The Core Mechanism</h3><ul><li>Monitors the call stack</li><li>Checks the task queue</li><li>Pushes callbacks when the stack is empty</li></ul><p>The event loop is a continuous process that checks whether JavaScript is free to execute the next task. If the call stack is empty and there is a completed asynchronous task waiting, the event loop moves it into the call stack.</p><p>This process happens repeatedly and very fast, creating the illusion of multitasking.</p><h3>Simple Code Example</h3><pre>console.log(&quot;Start&quot;);</pre><pre>setTimeout(() =&gt; {<br>  console.log(&quot;Async task completed&quot;);<br>}, 2000);<br>console.log(&quot;End&quot;);</pre><p>JavaScript prints Start, then immediately prints End. The timer runs outside JavaScript. After two seconds, the callback is pushed back to JavaScript and executed. JavaScript never paused execution.</p><p>This example perfectly demonstrates why asynchronous programming is essential.</p><h3>Why JavaScript Did Not Choose Multi-Threading</h3><ul><li>Complex memory management</li><li>Risk of race conditions</li><li>Difficult debugging</li></ul><p>Multi-threaded programming introduces complexity that is unnecessary for the browser. JavaScript chose a safer model. Single thread plus asynchronous execution gives performance without chaos.</p><p>This design keeps JavaScript beginner-friendly while still being powerful.</p><h3>Final Conclusion</h3><p>JavaScript uses asynchronous programming not to escape its single-threaded nature, but to protect it. The browser environment demands responsiveness, and asynchronous programming ensures JavaScript never blocks the user interface.</p><p>JavaScript does not do many things at once. It does one thing at a time, very fast, and never waits unnecessarily.</p><p>That is not a limitation. That is a design strength.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e9da2800de4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Essential DOM Methods in JavaScript]]></title>
            <link>https://medium.com/@ajiththika17/essential-dom-methods-in-javascript-e87550c7edd3?source=rss-7187b4057ddc------2</link>
            <guid isPermaLink="false">https://medium.com/p/e87550c7edd3</guid>
            <dc:creator><![CDATA[Ajiththika Sivathas]]></dc:creator>
            <pubDate>Mon, 08 Dec 2025 22:47:09 GMT</pubDate>
            <atom:updated>2025-12-08T22:47:09.406Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cueeqGJQs7Gj1fccP6AlFg.png" /><figcaption>DOM</figcaption></figure><p>JavaScript alone cannot touch webpage content. HTML alone cannot react to users. CSS alone cannot process logic. <strong>DOM connects all three and turns static documents into interactive applications.</strong> <strong>Every click, scroll, animation, validation, and dynamic update</strong> depends on the DOM. Mastering the DOM is one of the highest return investments for any beginner web developer.</p><h3>What Is DOM in JavaScript</h3><p>DOM stands for <strong>Document Object Model</strong>. The browser reads HTML and converts the entire document into a tree-like object structure in memory. Each <strong>HTML element becomes a node. Parent-child relationships mirror the actual layout structure. </strong>JavaScript interacts with this object tree rather than raw HTML. When content changes through JavaScript, the browser updates the visual output instantly without refreshing the page.</p><p>DOM is not part of the JavaScript language itself. <strong>DOM is a Web API provided by the browser. </strong>That is why the same JavaScript behaves differently in a browser versus a server environment like Node.js.</p><h3>How DOM Works Behind the Scenes</h3><p>When the browser loads a page, three main steps happen. First, HTML gets parsed into the DOM tree. Second CSS gets converted into the CSS Object Model. Third, both trees are combined into a render tree, which controls layout and painting. When JavaScript updates the DOM, only the affected part of the render tree updates, which <strong>makes modern websites fast and responsive.</strong></p><h3>Why is the DOM a Mandatory Skill for Frontend Developers</h3><p>DOM controls all real user interactions. Without DOM, professional frontend development is impossible.</p><p>Core responsibilities handled by DOM include<br> • Dynamic content rendering<br> • User input detection<br> • Form validation<br> • Live styling updates<br> • Animations and transitions<br> • API data injection<br> • Page state management</p><p>Every framework eventually manipulates the DOM directly or virtually.</p><h3>DOM Methods</h3><h4>document.getElementById</h4><p>This method selects exactly one element using the id attribute. Since ID must be unique, the result is always a single node or null. getElementById is one of the fastest DOM selection methods.</p><pre>&lt;h1 id=&quot;mainTitle&quot;&gt;Welcome&lt;/h1&gt;</pre><pre>const title = document.getElementById(&quot;mainTitle&quot;);<br>title.textContent = &quot;DOM Is Powerful&quot;;<br>title.style.color = &quot;green&quot;;</pre><h4>document.getElementsByClassName</h4><p>This method selects all elements that share the same class. It returns a live HTMLCollection. Live means it updates automatically when the DOM changes. That behavior can be powerful but sometimes confusing.</p><pre>&lt;p class=&quot;note&quot;&gt;First&lt;/p&gt;<br>&lt;p class=&quot;note&quot;&gt;Second&lt;/p&gt;</pre><pre>const notes = document.getElementsByClassName(&quot;note&quot;);<br>notes[0].textContent = &quot;Updated First&quot;;</pre><h4>document.getElementsByTagName</h4><p>This method selects elements by tag name and returns an HTMLCollection. Useful when the structure is predictable, like list items or table cells.</p><pre>&lt;li&gt;Item One&lt;/li&gt;<br>&lt;li&gt;Item Two&lt;/li&gt;</pre><pre>const items = document.getElementsByTagName(&quot;li&quot;);<br>items[1].textContent = &quot;Updated Item&quot;;</pre><h4>document.querySelector</h4><p>querySelector returns the first matching element based on CSS selector logic. It unifies id, class, attribute, and complex selectors into one method.</p><pre>&lt;div class=&quot;box&quot;&gt;&lt;/div&gt;</pre><pre>const box = document.querySelector(&quot;.box&quot;);<br>box.style.backgroundColor = &quot;blue&quot;;</pre><h4>document.querySelectorAll</h4><p>querySelectorAll returns a NodeList of all matching elements. NodeList is a static snapshot and supports forEach looping.</p><pre>&lt;button class=&quot;btn&quot;&gt;One&lt;/button&gt;<br>&lt;button class=&quot;btn&quot;&gt;Two&lt;/button&gt;</pre><pre>const buttons = document.querySelectorAll(&quot;.btn&quot;);</pre><pre>buttons.forEach(button =&gt; {<br>  button.textContent = &quot;Ready&quot;;<br>});</pre><h4>element.textContent vs innerHTML</h4><p>textContent changes only text and ignores HTML parsing. innerHTML injects real HTML markup. textContent is safer and faster. innerHTML is powerful but heavy.</p><pre>element.textContent = &quot;Safe Update&quot;;<br>element.innerHTML = &quot;&lt;strong&gt;Bold Text&lt;/strong&gt;&quot;;</pre><h4>element.style and Computed Styling</h4><p>style property directly modify inline CSS. It overrides stylesheet rules. For computed styles, getComputedStyle is used.</p><pre>const card = document.querySelector(&quot;.card&quot;);<br>card.style.backgroundColor = &quot;orange&quot;;</pre><h4>element.classList and Dynamic UI Control</h4><p>classList allows adding, removing, toggling, and checking class existence. This method drives animations, modal systems, responsive navigation, and state-based UI.</p><pre>panel.classList.toggle(&quot;active&quot;);</pre><h4>document.createElement and appendChild</h4><p>Dynamic UI generation depends on these two methods. Applications create cards, lists, messages, and forms dynamically using createElement, then attach using appendChild.</p><pre>const item = document.createElement(&quot;li&quot;);<br>item.textContent = &quot;Dynamic Item&quot;;</pre><pre>const list = document.querySelector(&quot;ul&quot;);<br>list.appendChild(item);</pre><h4>element.remove and Memory Cleanup</h4><p>element.remove deletes the node from the DOM tree instantly. Removing unused nodes improves performance and prevents memory leaks in large apps.</p><pre>popup.remove();</pre><h4>element.addEventListener and Event System</h4><p>This method attaches an event handler to the selected element. It supports unlimited event types including click, input, submit, scroll, keydown and many more.</p><pre>button.addEventListener(&quot;click&quot;, () =&gt; {<br>  console.log(&quot;Button clicked&quot;);<br>});</pre><h4>Event Bubbling and Delegation Concept</h4><p>Events bubble from child to parent. Event delegation uses this behavior to handle multiple elements using a single listener. This technique improves performance in dynamic lists.</p><h4>document.body and document.title</h4><p>These properties control the page structure and browser tab dynamically.</p><pre>document.title = &quot;DOM Learning Page&quot;;<br>document.body.style.backgroundColor = &quot;lightgray&quot;;</pre><h3>DOM and Forms</h3><p>DOM handles real-time form validation, capturing input values, preventing default submission, and displaying error messages dynamically. Every login system depends on the DOM.</p><h3>DOM and API Data Rendering</h3><p>Most real projects fetch data from a server, then create elements dynamically and inject them into the DOM. Without DOM, the frontend cannot display live data.</p><h3>Common Beginner Mistakes</h3><p>• Selecting elements before the DOM loads<br> • Expecting querySelector to return multiple nodes<br> • Using innerHTML everywhere<br> • Forgetting performance during loops<br> • Mixing up live and static collections</p><h3>Why DOM Mastery Accelerates Career Growth</h3><p>• Freelance work depends on the DOM<br> • Technical interviews test DOM logic<br> • Frameworks require DOM knowledge<br> • Performance optimization depends on DOM understanding</p><h3>Final Conclusion</h3><p>DOM is the foundation of frontend engineering. JavaScript becomes powerful only when connected with the DOM. Learning the DOM deeply at the beginner stage builds confidence, eliminates future confusion, and unlocks full frontend development potential. Every modern website breathes through the DOM.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e87550c7edd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>