<?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 NeranjiAbeysekara on Medium]]></title>
        <description><![CDATA[Stories by NeranjiAbeysekara on Medium]]></description>
        <link>https://medium.com/@anuththaraneranji?source=rss-4f04ef583aec------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by NeranjiAbeysekara on Medium</title>
            <link>https://medium.com/@anuththaraneranji?source=rss-4f04ef583aec------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 18:20:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anuththaraneranji/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[What I Wish I Knew Before Starting Software Engineering]]></title>
            <link>https://medium.com/@anuththaraneranji/what-i-wish-i-knew-before-starting-software-engineering-5c6c07939778?source=rss-4f04ef583aec------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c6c07939778</guid>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[NeranjiAbeysekara]]></dc:creator>
            <pubDate>Fri, 10 Jul 2026 17:31:23 GMT</pubDate>
            <atom:updated>2026-07-10T17:31:23.077Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first decided to study Software Engineering, I imagined a world of exciting projects, clean code, and innovative technology. I thought I would spend my days building amazing applications, solving interesting problems, and eventually landing a dream job.</p><p>Reality turned out to be a little different.</p><p>Software Engineering has been one of the most rewarding journeys of my life, but it has also been one of the most challenging. Looking back, there are many things I wish someone had told me before I started. They wouldn’t have made the journey easier, but they would have helped me approach it with the right mindset.</p><p>If you’re thinking about becoming a software engineer or you’ve just started your journey, here are the lessons I wish I had learned earlier.</p><h3>1. Programming Is Only a Small Part of Software Engineering</h3><p>One of the biggest surprises was realizing that programming is only one piece of the puzzle.</p><p>Before university, I assumed software engineering was all about writing code. In reality, coding is just one skill among many.</p><p>Software engineers also spend time:</p><ul><li>Understanding user requirements</li><li>Designing systems</li><li>Debugging existing applications</li><li>Testing software</li><li>Reviewing other people’s code</li><li>Working with databases</li><li>Communicating with teammates</li><li>Planning projects</li><li>Writing documentation</li></ul><p>A successful software engineer isn’t simply someone who writes clever code. They’re someone who can solve real-world problems effectively.</p><p>That shift in perspective changed the way I approached learning.</p><h3>2. Google Isn’t Cheating</h3><p>I used to think good programmers memorized everything.</p><p>I couldn’t have been more wrong.</p><p>Professional developers constantly search for documentation, read technical articles, browse forums, and learn from official guides.</p><p>The important skill isn’t memorizing every function or syntax.</p><p>It’s knowing:</p><ul><li>What you’re trying to solve</li><li>How to search effectively</li><li>How to evaluate solutions</li><li>How to adapt them to your own project</li></ul><p>Learning how to ask better questions often matters more than having all the answers.</p><h3>3. Debugging Will Take More Time Than Coding</h3><p>No one tells beginners how much time they’ll spend debugging.</p><p>Sometimes you’ll spend three hours searching for a bug caused by a missing semicolon, an incorrect variable name, or a misplaced bracket.</p><p>At first, this feels frustrating.</p><p>Eventually, you realize debugging isn’t a sign that you’re failing — it’s part of software engineering.</p><p>Every bug teaches you something about how computers actually work.</p><p>Some of the best learning experiences happen when nothing works.</p><h3>4. You’ll Never Know Everything</h3><p>Technology changes incredibly fast.</p><p>Every year, new programming languages, frameworks, libraries, cloud services, and AI tools emerge.</p><p>Trying to learn everything is impossible.</p><p>Instead, focus on building strong fundamentals:</p><ul><li>Problem solving</li><li>Algorithms</li><li>Data structures</li><li>Object-oriented programming</li><li>Databases</li><li>Networking basics</li><li>Version control</li></ul><p>Frameworks come and go.</p><p>Strong fundamentals stay valuable for decades.</p><h3>5. Communication Is a Superpower</h3><p>This one surprised me the most.</p><p>Many people think software engineering is a career where you sit alone writing code all day.</p><p>In reality, communication is everywhere.</p><p>You’ll explain technical ideas to teammates, discuss requirements with clients, review code, ask questions during meetings, and collaborate with designers, testers, and project managers.</p><p>Sometimes the engineer who communicates clearly creates more value than the one who writes the most complex code.</p><p>Technical skills may get you hired.</p><p>Communication skills often help you grow.</p><h3>6. Building Projects Matters More Than Watching Tutorials</h3><p>Tutorials are helpful.</p><p>But there’s a difference between following instructions and solving problems on your own.</p><p>I spent countless hours watching videos, only to realize I couldn’t build anything without them.</p><p>Everything changed when I started creating my own projects.</p><p>Even small applications teach valuable lessons:</p><ul><li>A to-do list</li><li>A weather app</li><li>A student management system</li><li>A personal portfolio</li><li>A budgeting application</li></ul><p>Projects force you to make decisions, fix mistakes, and think independently.</p><p>That’s where real learning happens.</p><h3>7. Failure Is Part of the Journey</h3><p>Every software engineer has experienced:</p><ul><li>Compilation errors</li><li>Failed interviews</li><li>Rejected job applications</li><li>Broken deployments</li><li>Lost code</li><li>Projects that never worked as expected</li></ul><p>Failure isn’t proof that you’re not good enough.</p><p>It’s proof that you’re learning.</p><p>Every experienced engineer has a long history of mistakes behind their success.</p><p>The difference is they kept going.</p><h3>8. Your Portfolio Speaks Louder Than Your GPA</h3><p>Academic results matter.</p><p>But employers often want to see what you can actually build.</p><p>A portfolio demonstrates:</p><ul><li>Practical skills</li><li>Creativity</li><li>Problem-solving ability</li><li>Initiative</li><li>Consistency</li></ul><p>Even a few well-documented projects on GitHub can make a stronger impression than simply listing programming languages on a résumé.</p><p>Don’t wait until graduation.</p><p>Start building today.</p><h3>9. Learn Git Early</h3><p>If I could go back and learn one tool sooner, it would be Git.</p><p>Version control helps you:</p><ul><li>Track changes</li><li>Collaborate with others</li><li>Restore previous versions</li><li>Experiment without fear</li><li>Manage professional projects</li></ul><p>At first, Git can seem confusing.</p><p>Eventually, you’ll wonder how you ever worked without it.</p><h3>10. Consistency Beats Intensity</h3><p>There were days when I wanted to study for ten hours straight.</p><p>There were also weeks when I barely opened my laptop.</p><p>Over time, I realized something important.</p><p>Learning for one focused hour every day is often more effective than cramming for twelve hours once a week.</p><p>Software engineering is a marathon, not a sprint.</p><p>Small improvements, repeated consistently, produce remarkable results.</p><h3>11. AI Is a Tool, Not a Replacement</h3><p>Artificial intelligence has transformed software development.</p><p>AI can generate code, explain concepts, find bugs, and increase productivity.</p><p>But relying entirely on AI without understanding the underlying concepts creates fragile knowledge.</p><p>The best engineers use AI to accelerate learning — not replace it.</p><p>If you understand why the code works, AI becomes a powerful assistant.</p><p>If you don’t, it becomes a crutch.</p><h3>12. Comparison Will Slow You Down</h3><p>One of the easiest ways to lose motivation is by comparing yourself to others.</p><p>Someone will always:</p><ul><li>Learn faster</li><li>Build better projects</li><li>Get internships earlier</li><li>Know more technologies</li><li>Land a better job</li></ul><p>Everyone’s journey is different.</p><p>Focus on becoming a better version of yourself than you were yesterday.</p><p>Progress compounds over time.</p><h3>Final Thoughts</h3><p>If I could give one piece of advice to my younger self, it would be this:</p><p><strong>Don’t focus on becoming someone who can write code. Focus on becoming someone who can solve problems.</strong></p><p>Programming languages will evolve.</p><p>Frameworks will change.</p><p>Technology will continue moving forward.</p><p>But curiosity, persistence, adaptability, and the willingness to keep learning will always be valuable.</p><p>Software engineering isn’t about reaching a point where you know everything.</p><p>It’s about embracing the fact that you’ll always have something new to learn.</p><p>And that’s what makes this career so exciting.</p><p>Whether you’re writing your first “Hello, World!” program or preparing for your first software engineering job, remember that every expert was once a beginner.</p><p>Keep building.</p><p>Keep learning.</p><p>Keep asking questions.</p><p>One day, you’ll look back and realize that every challenge helped shape the engineer you’ve become.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c6c07939778" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Authentication: Sessions vs JWT vs OAuth2 vs Identity Providers.]]></title>
            <link>https://medium.com/@anuththaraneranji/mastering-authentication-sessions-vs-jwt-vs-oauth2-vs-identity-providers-6b68e1b1c118?source=rss-4f04ef583aec------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b68e1b1c118</guid>
            <category><![CDATA[identity-provider]]></category>
            <category><![CDATA[jwt-authentication]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[authentication]]></category>
            <dc:creator><![CDATA[NeranjiAbeysekara]]></dc:creator>
            <pubDate>Thu, 05 Jun 2025 07:50:02 GMT</pubDate>
            <atom:updated>2025-06-05T07:51:25.019Z</atom:updated>
            <content:encoded><![CDATA[<p>In the evolving world of web and app development, <strong>authentication</strong> is one of the most critical features to get right. Whether you’re building a blog, an enterprise app, or an e-commerce platform, users need a secure and seamless way to log in and stay logged in.</p><p>But how do we choose between <strong>Sessions</strong>, <strong>JWT</strong>, <strong>OAuth2</strong>, or modern tools like <strong>Clerk</strong>?</p><h3>1️⃣ Sessions — The Traditional Approach</h3><p><strong>Sessions</strong> have been the foundation of user authentication for years, especially in server-rendered applications.</p><h4>🔧 How it works:</h4><ul><li>When a user logs in, the server creates a session on the backend.</li><li>A unique session ID is stored in a cookie on the user’s browser.</li><li>On each request, this session ID is sent back to the server, which then looks up the session and confirms the user’s identity.</li></ul><h4>✅ Advantages:</h4><ul><li>Secure, since the session data is stored on the server.</li><li>Session invalidation (logout, session timeout) is straightforward.</li></ul><h4>❌ Disadvantages:</h4><ul><li>Not scalable by default (sessions must be stored and synced, which becomes challenging in distributed systems).</li><li>Less ideal for stateless API-based architectures.</li></ul><h4>📌 Best for:</h4><p>Traditional server-rendered apps where server-side state is acceptable.</p><h3>2️⃣ JWT (JSON Web Tokens) — Stateless and Scalable</h3><p><strong>JWT</strong> is a compact, self-contained way to transmit information securely between parties. It’s particularly popular in modern web apps and APIs.</p><h4>🔧 How it works:</h4><ul><li>After a successful login, the server generates a token containing user data (e.g., ID, role).</li><li>This token is signed and sent to the client (stored in localStorage or cookies).</li><li>The client sends this token on every request for authentication.</li><li>Since the token contains the necessary info, the server doesn’t need to store sessions.</li></ul><h4>✅ Advantages:</h4><ul><li>Stateless (no server-side session storage required).</li><li>Easily scalable across multiple servers or microservices.</li><li>Works well with SPAs and mobile apps.</li></ul><h4>❌ Disadvantages:</h4><ul><li>Token revocation is difficult unless additional mechanisms (e.g., token blacklists) are used.</li><li>If stored in localStorage, tokens are vulnerable to XSS attacks.</li></ul><h4>📌 Best for:</h4><p>Modern, scalable, stateless applications (SPAs, mobile apps, RESTful APIs).</p><h3>3️⃣ OAuth2 — Delegated Authorization</h3><p><strong>OAuth2</strong> is not primarily an authentication protocol, but an <strong>authorization framework</strong>. It’s most commonly used when users log in with third-party providers like Google, GitHub, Facebook, etc.</p><h4>🔧 How it works:</h4><ul><li>Your app redirects users to a provider (e.g., Google) for login.</li><li>The provider authenticates the user and returns a token.</li><li>Your app uses this token to fetch user information from the provider.</li></ul><h4>✅ Advantages:</h4><ul><li>No need to manage passwords.</li><li>Users can authenticate using trusted services they already use.</li><li>Enables secure delegated access to third-party APIs.</li></ul><h4>❌ Disadvantages:</h4><ul><li>Implementation is more complex (requires redirect flows, token handling).</li><li>Slight learning curve with flows like Authorization Code, Implicit, etc.</li></ul><h4>📌 Best for:</h4><p>Apps that offer “Login with Google/GitHub” and need secure third-party access.</p><h3>4️⃣ Identity Providers (IDPs) — Like Clerk, Auth0, Firebase Auth</h3><p><strong>IDPs</strong> are full authentication platforms that take care of login, session management, password reset, multi-factor authentication, social login, and more. Tools like <strong>Clerk</strong>, <strong>Auth0</strong>, and <strong>Firebase Auth</strong> fall under this category.</p><h4>🔧 How it works:</h4><ul><li>You integrate a third-party platform that manages authentication flows.</li><li>The IDP provides UI components (sign-in forms, sign-up pages) and APIs.</li><li>These services often combine the best of Sessions, JWT, and OAuth2 under one roof.</li></ul><h4>✅ Advantages:</h4><ul><li>Saves development time.</li><li>Secure and regularly updated.</li><li>Includes features like biometric auth, social login, and MFA by default.</li></ul><h4>❌ Disadvantages:</h4><ul><li>Dependency on a third-party.</li><li>Pricing may increase as your app scales.</li><li>Less control over internals unless customization is supported.</li></ul><h4>📌 Best for:</h4><p>Teams who want to implement reliable authentication quickly, without reinventing the wheel.</p><h3>🚀 Which Should You Choose?</h3><p>It depends on your project’s structure, audience, and complexity:</p><ul><li><strong>Small web apps</strong>: Sessions are fine.</li><li><strong>Large-scale frontends &amp; APIs</strong>: JWT or IDPs.</li><li><strong>Need social login or federated auth</strong>: OAuth2 or IDPs.</li><li><strong>Tight deadlines &amp; security focus</strong>: Use an IDP like Clerk, which wraps everything in one simple integration.</li></ul><p>There’s no one-size-fits-all solution. The best approach depends on your app’s needs, your architecture (monolith vs microservices), and the time you’re willing to invest in security implementation.</p><p>Authentication is the gatekeeper of user experience and security — choose wisely, and always keep scalability and safety in mind.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b68e1b1c118" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevOps and Continuous Integration/Continuous Deployment (CI/CD)]]></title>
            <link>https://medium.com/@anuththaraneranji/devops-and-continuous-integration-continuous-deployment-ci-cd-6d7ca9d9a734?source=rss-4f04ef583aec------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d7ca9d9a734</guid>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[NeranjiAbeysekara]]></dc:creator>
            <pubDate>Thu, 06 Feb 2025 05:31:19 GMT</pubDate>
            <atom:updated>2025-02-06T05:31:19.913Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Impact of DevOps and CI/CD on Software Development Efficiency and Quality 🚀</h3><p>If you’ve been working in software development or IT, you’ve probably heard a lot about <strong>DevOps</strong> and <strong>Continuous Integration/Continuous Deployment (CI/CD)</strong>. But what exactly do they mean, and why is everyone talking about them? Let’s dive into how DevOps and CI/CD practices have transformed the way we develop software — making development faster, more efficient, and with better quality. 🤖</p><h4>What is DevOps? 🤔</h4><p>At its core, <strong>DevOps</strong> is all about breaking down the traditional silos between development and operations teams. It’s a culture, a set of practices, and a mindset aimed at improving collaboration and communication. The goal? To deliver software faster, more efficiently, and more reliably.</p><p>DevOps isn’t a tool or a specific technology — it’s a philosophy. It focuses on automating processes, improving workflows, and speeding up the software delivery cycle. DevOps encourages close collaboration between <strong>developers</strong>, <strong>operations teams</strong>, and <strong>other stakeholders</strong> to make the whole process smoother.</p><h4>What is CI/CD? ⚙️</h4><p>Now, <strong>Continuous Integration (CI)</strong> and <strong>Continuous Deployment (CD)</strong> are two key practices that come under the DevOps umbrella. Let’s break them down:</p><ul><li><strong>Continuous Integration (CI)</strong>: The practice of frequently merging small code changes into a shared repository. Instead of working in isolation for weeks or months and merging everything at once, developers integrate their changes regularly — sometimes multiple times a day. The goal is to detect issues early and fix them before they turn into bigger problems.</li><li><strong>Continuous Deployment (CD)</strong>: This takes CI a step further. With CD, every change that passes automated tests is automatically deployed to production. There’s no waiting for a big release; small, incremental changes are pushed out to users as soon as they’re ready. It’s about automating the release process so that software is always in a deployable state.</li></ul><h4>How Does CI/CD Impact Software Development? 🔥</h4><p>The introduction of CI/CD has been a game-changer in how we build software. Let’s look at the key impacts:</p><ol><li><strong>Faster Development Cycle</strong> ⏱️</li></ol><p>With CI/CD, developers no longer have to wait for a major release to push their changes live. They can integrate and deploy changes continuously, which means software updates are delivered faster. The development process is broken into smaller, more manageable parts, so teams can move faster and with more agility.</p><ol><li><strong>Higher Quality Code</strong> 🏆</li></ol><p>Since CI involves frequent testing and integration of code, developers can catch bugs and issues early in the process. This means the codebase is always in a “working” state, and the team can resolve issues quickly before they escalate. Automated tests run as part of the CI pipeline help ensure that new code doesn’t break existing features.</p><ol><li><strong>Reduced Risk</strong> ⚖️</li></ol><p>One of the challenges with traditional software development is that updates are released infrequently, and when they do go live, they often come with a lot of changes. This increases the risk of bugs, errors, or failures. With CI/CD, since changes are smaller and deployed incrementally, the risk is spread out and more manageable. You can easily rollback a change if something goes wrong.</p><ol><li><strong>Better Collaboration and Communication</strong> 👥</li></ol><p>CI/CD encourages a culture of collaboration between developers, QA, and operations teams. In traditional workflows, developers and operations might work in silos, leading to delays and miscommunication. DevOps, through CI/CD, promotes real-time feedback and closer teamwork. Everyone is on the same page, making it easier to identify and fix issues quickly.</p><ol><li><strong>Automated and Efficient Processes</strong> 🤖</li></ol><p>Automation is the backbone of CI/CD. From automated testing to automatic deployment, much of the manual work that traditionally slowed down the software development process is now automated. This speeds up everything from building to testing to deployment, freeing up developers to focus on what really matters: writing code and improving the product.</p><ol><li><strong>Faster Time-to-Market</strong> 🏁</li></ol><p>CI/CD accelerates the software release process, meaning your team can deliver new features, fixes, and updates to users faster. In today’s competitive landscape, speed is crucial, and CI/CD helps teams stay ahead by constantly improving and releasing the software. The quicker your team can deploy, the faster you can respond to customer needs.</p><h4>The Key Benefits of CI/CD in Action 📈</h4><ul><li><strong>Efficiency</strong>: CI/CD reduces manual work by automating repetitive tasks like testing, integration, and deployment. Developers spend less time on infrastructure and more time coding.</li><li><strong>Quality</strong>: By continuously testing and integrating code, CI/CD ensures that bugs are caught early, improving the overall quality of the software. It also leads to fewer issues during deployment since smaller, incremental changes are easier to manage and troubleshoot.</li><li><strong>Scalability</strong>: With CI/CD, scaling applications and services is much easier because deployments are automated, which reduces human error and the complexity of handling large-scale systems.</li></ul><h4>Challenges of Implementing CI/CD ⚠️</h4><p>While CI/CD offers a ton of benefits, it’s not without its challenges:</p><ul><li><strong>Initial Setup</strong>: Setting up CI/CD pipelines can be time-consuming and requires expertise in automation tools. You’ll need to invest time in configuring everything from testing to deployment.</li><li><strong>Cultural Shift</strong>: For organizations used to traditional development practices, moving to a CI/CD workflow can be a big cultural shift. Teams must embrace collaboration and take ownership of their entire code pipeline — from development to deployment.</li><li><strong>Tooling</strong>: CI/CD relies heavily on the right tools. From GitHub to Jenkins to Docker, selecting and configuring the right set of tools is crucial for success.</li></ul><h4>Why CI/CD is a Must for Modern Development 🚀</h4><p>CI/CD practices are quickly becoming the norm in software development, and for good reason. By automating and continuously improving every stage of the development lifecycle, teams can deliver software faster, with higher quality, and with less risk. As software becomes more complex and fast-paced, CI/CD enables developers to stay agile and competitive.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d7ca9d9a734" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agile vs. Waterfall Methodologies.]]></title>
            <link>https://medium.com/@anuththaraneranji/agile-vs-waterfall-methodologies-6aa7fe237039?source=rss-4f04ef583aec------2</link>
            <guid isPermaLink="false">https://medium.com/p/6aa7fe237039</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[NeranjiAbeysekara]]></dc:creator>
            <pubDate>Thu, 06 Feb 2025 05:26:05 GMT</pubDate>
            <atom:updated>2025-02-06T05:26:05.839Z</atom:updated>
            <content:encoded><![CDATA[<h3>Which Methodology Works Best for Your Project?</h3><p>If you’re working in IT or involved in software development, you’ve probably heard of <strong>Agile</strong> and <strong>Waterfall</strong> — but what are they, really? And more importantly, which one should you use for your projects? Let’s break it down in a way that makes sense, even if you’re not a project manager.</p><h4>What is Waterfall? 🌊</h4><p>Waterfall is the traditional way of managing projects. It’s a step-by-step approach where you complete one phase before moving on to the next. It looks something like this:</p><ol><li><strong>Planning</strong>: Everything is outlined and planned from the beginning.</li><li><strong>Design</strong>: You create the design based on the plan.</li><li><strong>Development</strong>: You build the system based on the design.</li><li><strong>Testing</strong>: After development, you test the system to make sure it works.</li><li><strong>Deployment</strong>: Once everything is ready, the project is launched.</li></ol><p>Think of Waterfall like a strict to-do list: You can’t move on to the next item until the current task is done. It’s a very <strong>linear</strong> approach.</p><h4>What is Agile? ⚡</h4><p>Agile, on the other hand, is much more flexible and iterative. Rather than following a strict sequence, you break the project into smaller parts, called “sprints,” and work on them one by one. Here’s how it typically works:</p><ol><li><strong>Planning</strong>: You plan for the first sprint.</li><li><strong>Design &amp; Develop</strong>: Design and develop a small feature.</li><li><strong>Test</strong>: Test that feature.</li><li><strong>Review</strong>: Get feedback from the team or users.</li><li><strong>Repeat</strong>: Move on to the next sprint, building on the previous work.</li></ol><p>The goal here is to deliver a small, working piece of the project every few weeks, which makes it easier to adjust and improve as you go.</p><h4>How are They Different? 🤔</h4><ul><li><strong>Flexibility</strong>: Agile gives you more flexibility to change things mid-project. Waterfall requires you to stick to the original plan once you start.</li><li><strong>Planning</strong>: Waterfall is all about planning up front. With Agile, planning is done in chunks, typically before each sprint.</li><li><strong>Progress</strong>: Waterfall doesn’t give you much of a look at the final product until the very end. Agile delivers frequent, smaller updates, so you can see progress more regularly.</li><li><strong>Feedback</strong>: Agile focuses on constant feedback throughout the project. In Waterfall, feedback is typically gathered at the end, once everything is done.</li></ul><h4>When Should You Use Waterfall? 🌊</h4><p>Waterfall works best when:</p><ul><li>The project is straightforward, with clear requirements from the start.</li><li>There’s little to no expectation of changes during the project.</li><li>You need a set timeline and structure (like for construction or manufacturing).</li></ul><h4>When is Agile the Better Choice? ⚡</h4><p>Agile is ideal when:</p><ul><li>You’re dealing with a complex project with evolving requirements.</li><li>You need quick feedback and constant collaboration.</li><li>You’re building something that will need regular updates, like a software product.</li></ul><h4>Pros and Cons 📋</h4><p><strong>Waterfall Pros:</strong></p><ul><li>Clear structure and timeline.</li><li>Easier to manage for smaller projects with fixed requirements.</li><li>You know exactly what’s coming next at each phase.</li></ul><p><strong>Waterfall Cons:</strong></p><ul><li>Making changes once you’ve started is tough.</li><li>No room for adjustments based on feedback until after the project is finished.</li><li>Can feel slow and rigid.</li></ul><p><strong>Agile Pros:</strong></p><ul><li>Flexibility to adapt and change based on feedback.</li><li>Frequent releases that allow you to quickly deliver value.</li><li>Strong focus on teamwork and collaboration.</li></ul><p><strong>Agile Cons:</strong></p><ul><li>Can be chaotic if not properly managed.</li><li>Requires constant communication and involvement.</li><li>Might be harder to predict timelines and costs early on.</li></ul><h4>So, Which One Should You Pick? 🤔</h4><p>At the end of the day, it depends on the project. If you need flexibility, constant feedback, and iterative progress, <strong>Agile</strong> is the way to go. If your project is straightforward with clear requirements from the start and no real expectation for changes, then <strong>Waterfall</strong> might be the better fit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6aa7fe237039" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding and Using React Icons in Your App]]></title>
            <link>https://medium.com/@anuththaraneranji/adding-and-using-react-icons-in-your-app-c7ae1f363d7d?source=rss-4f04ef583aec------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7ae1f363d7d</guid>
            <dc:creator><![CDATA[NeranjiAbeysekara]]></dc:creator>
            <pubDate>Tue, 10 Sep 2024 14:47:09 GMT</pubDate>
            <atom:updated>2024-09-10T14:47:09.708Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>React Icons is a popular library that provides a wide range of icons from various icon sets. It simplifies adding icons to your React components without the need to handle SVG files directly. This guide will walk you through installing and using React Icons in your React application.</p><h3>Step-by-Step Guide</h3><h4>Install React Icons</h4><p>First, you need to install the react-icons library. You can do this using npm or yarn:</p><pre>npm install react-icons</pre><p>Or</p><pre>yarn add react-icons</pre><h4>Import Icons in Your Component</h4><p>Once installed, you can import icons from various icon sets included in the library. Here’s an example of how to use some popular icons:</p><pre>import React from &#39;react&#39;;<br>import { FaBeer, FaFacebook, FaTwitter } from &#39;react-icons/fa&#39;; // Import icons from Font Awesome<br>import { AiFillHome, AiOutlineSetting } from &#39;react-icons/ai&#39;; // Import icons from Ant Design<br><br>function App() {<br>  return (<br>    &lt;div className=&quot;App&quot;&gt;<br>      &lt;h1&gt;React Icons Example&lt;/h1&gt;<br>      <br>      &lt;div className=&quot;icons&quot;&gt;<br>        &lt;FaBeer size={40} color=&quot;gold&quot; /&gt; {/* Beer icon with size and color */}<br>        &lt;FaFacebook size={40} color=&quot;#4267B2&quot; /&gt; {/* Facebook icon */}<br>        &lt;FaTwitter size={40} color=&quot;#1DA1F2&quot; /&gt; {/* Twitter icon */}<br>        &lt;AiFillHome size={40} color=&quot;green&quot; /&gt; {/* Home icon */}<br>        &lt;AiOutlineSetting size={40} color=&quot;gray&quot; /&gt; {/* Settings icon */}<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><h4>Style the Icons</h4><p>You can customize the icons using inline styles or CSS classes. The size and color props directly affect the icon&#39;s appearance.</p><p>Inline Styles</p><pre>&lt;FaBeer style={{ fontSize: &#39;40px&#39;, color: &#39;gold&#39; }} /&gt;</pre><p>CSS Classes</p><pre>.icon {<br>  font-size: 40px;<br>  color: gold;<br>}</pre><pre>&lt;FaBeer className=&quot;icon&quot; /&gt;</pre><h4>Use Icons for Buttons or Links</h4><p>You can also use icons as part of buttons or links. Here’s an example:</p><pre>import { FaGoogle, FaGithub } from &#39;react-icons/fa&#39;;<br><br>function SocialButtons() {<br>  return (<br>    &lt;div className=&quot;social-buttons&quot;&gt;<br>      &lt;button&gt;<br>        &lt;FaGoogle size={20} color=&quot;#DB4437&quot; /&gt; Sign in with Google<br>      &lt;/button&gt;<br>      &lt;button&gt;<br>        &lt;FaGithub size={20} color=&quot;#333&quot; /&gt; Sign in with GitHub<br>      &lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><h3>Key Concepts</h3><ol><li><strong>Icon Sets</strong>: React Icons provides icons from various sets, including Font Awesome, Ant Design, Material Design, and more.</li><li><strong>Props</strong>: Customize icons using size, color, and other styling props.</li><li><strong>Integration</strong>: Use icons within components, buttons, and links to enhance user interface elements.</li></ol><p><strong><em>Check out the entire series </em></strong><a href="https://medium.com/@anuththaraneranji/reactjs-basics-series-1f3d6be2d9a4"><strong><em>here</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7ae1f363d7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating an Infinite Image Carousel in React]]></title>
            <link>https://medium.com/@anuththaraneranji/creating-an-infinite-image-carousel-in-react-b324bd324216?source=rss-4f04ef583aec------2</link>
            <guid isPermaLink="false">https://medium.com/p/b324bd324216</guid>
            <dc:creator><![CDATA[NeranjiAbeysekara]]></dc:creator>
            <pubDate>Tue, 10 Sep 2024 14:47:00 GMT</pubDate>
            <atom:updated>2024-09-10T14:47:00.364Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>An image carousel (or slider) is a popular UI component for displaying multiple images or content items in a rotating or sliding manner. Creating an infinite image carousel can enhance user experience by allowing smooth and continuous scrolling through images. This guide will walk you through building a basic infinite image carousel in React.</p><h3>Step-by-Step Guide</h3><h4>Set Up Your React Project</h4><p>Ensure you have a React project set up. If not, you can create one using Create React App:</p><pre>npx create-react-app infinite-carousel<br>cd infinite-carousel</pre><h4>Install Dependencies</h4><p>You might need additional packages for handling images and animations. For this example, you can use react-slick for the carousel functionality and slick-carousel for styling.</p><pre>npm install react-slick slick-carousel</pre><p>You also need to include the slick-carousel CSS in your project. Add this to your src/index.css or src/App.css:</p><pre>/* slick-carousel CSS */<br>@import &quot;~slick-carousel/slick/slick.css&quot;;<br>@import &quot;~slick-carousel/slick/slick-theme.css&quot;;</pre><h4>Create the Carousel Component</h4><p>Create a new component called ImageCarousel.js in your src folder.</p><pre>import React from &#39;react&#39;;<br>import Slider from &#39;react-slick&#39;;<br><br>const ImageCarousel = () =&gt; {<br>  // Array of image URLs<br>  const images = [<br>    &#39;https://via.placeholder.com/800x400?text=Image+1&#39;,<br>    &#39;https://via.placeholder.com/800x400?text=Image+2&#39;,<br>    &#39;https://via.placeholder.com/800x400?text=Image+3&#39;,<br>    &#39;https://via.placeholder.com/800x400?text=Image+4&#39;<br>  ];<br><br>  // Slider settings<br>  const settings = {<br>    dots: true, // Show dots for navigation<br>    infinite: true, // Enable infinite looping<br>    speed: 500, // Transition speed<br>    slidesToShow: 1, // Number of slides to show<br>    slidesToScroll: 1 // Number of slides to scroll<br>  };<br><br>  return (<br>    &lt;div className=&quot;carousel-container&quot;&gt;<br>      &lt;Slider {...settings}&gt;<br>        {images.map((src, index) =&gt; (<br>          &lt;div key={index}&gt;<br>            &lt;img src={src} alt={`Slide ${index}`} style={{ width: &#39;100%&#39;, height: &#39;auto&#39; }} /&gt;<br>          &lt;/div&gt;<br>        ))}<br>      &lt;/Slider&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default ImageCarousel;</pre><h4>Add Carousel Styles</h4><p>Add some basic styles for the carousel in your src/App.css or src/index.css.</p><pre>.carousel-container {<br>  width: 80%;<br>  margin: auto;<br>}<br><br>.slick-slide img {<br>  border-radius: 8px;<br>}</pre><h4>Use the Carousel Component</h4><p>Include the ImageCarousel component in your App.js file.</p><pre>import React from &#39;react&#39;;<br>import ImageCarousel from &#39;./ImageCarousel&#39;;<br>import &#39;./App.css&#39;;<br><br>function App() {<br>  return (<br>    &lt;div className=&quot;App&quot;&gt;<br>      &lt;h1&gt;Infinite Image Carousel&lt;/h1&gt;<br>      &lt;ImageCarousel /&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><h3>Key Concepts</h3><ol><li><strong>React Slick</strong>: A carousel component for React that simplifies creating sliders and carousels with many built-in features.</li><li><strong>Infinite Looping</strong>: Enabled by setting infinite: true in the slider settings to allow continuous scrolling.</li><li><strong>Responsive Design</strong>: Ensure that your carousel is responsive by using CSS and the react-slick settings.</li></ol><p><strong><em>Check out the entire series </em></strong><a href="https://medium.com/@anuththaraneranji/reactjs-basics-series-1f3d6be2d9a4"><strong><em>here</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b324bd324216" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prop Drilling vs. Using the useContext Hook in React]]></title>
            <link>https://medium.com/@anuththaraneranji/prop-drilling-vs-using-the-usecontext-hook-in-react-78bc0f814646?source=rss-4f04ef583aec------2</link>
            <guid isPermaLink="false">https://medium.com/p/78bc0f814646</guid>
            <dc:creator><![CDATA[NeranjiAbeysekara]]></dc:creator>
            <pubDate>Tue, 10 Sep 2024 14:43:42 GMT</pubDate>
            <atom:updated>2024-09-10T14:43:42.544Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In React, managing state and passing data through multiple levels of components can become complex, a challenge known as <strong>prop drilling</strong>. To address this, React provides the useContext hook, which simplifies state management across deeply nested components. Let’s explore both concepts and see how useContext can be a game-changer.</p><h3>Understanding Prop Drilling</h3><p><strong>Prop drilling</strong> occurs when you pass data from a parent component down to child components, and then down further to nested components. This can lead to props being passed through many layers of components, making the code harder to manage and understand.</p><h4>Example of Prop Drilling</h4><p>Suppose you have a component structure like this:</p><pre>function App() {<br>  const user = { name: &#39;Alice&#39; };<br>  <br>  return (<br>    &lt;ParentComponent user={user} /&gt;<br>  );<br>}<br><br>function ParentComponent({ user }) {<br>  return (<br>    &lt;ChildComponent user={user} /&gt;<br>  );<br>}<br><br>function ChildComponent({ user }) {<br>  return (<br>    &lt;GrandchildComponent user={user} /&gt;<br>  );<br>}<br><br>function GrandchildComponent({ user }) {<br>  return (<br>    &lt;div&gt;Welcome, {user.name}!&lt;/div&gt;<br>  );<br>}</pre><p>In this example, user is passed through ParentComponent and ChildComponent before reaching GrandchildComponent. This process, while functional, can become unwieldy as the component tree grows.</p><h3>Introducing the useContext Hook</h3><p>The useContext hook provides a more efficient way to share data across your component tree without having to pass props manually through every level. It uses the Context API, which allows you to create a context and provide its value to any component that needs it.</p><h4>How to Use useContext</h4><p><strong>Create a Context</strong></p><p>First, create a context using React.createContext.</p><pre>import React, { createContext, useContext } from &#39;react&#39;;<br><br>const UserContext = createContext();</pre><p><strong>Provide Context Value</strong></p><p>Use the Context.Provider to wrap your component tree and provide the context value.</p><pre>function App() {<br>  const user = { name: &#39;Alice&#39; };<br><br>  return (<br>    &lt;UserContext.Provider value={user}&gt;<br>      &lt;ParentComponent /&gt;<br>    &lt;/UserContext.Provider&gt;<br>  );<br>}</pre><p><strong>Consume Context Value</strong></p><p>Use the useContext hook in any component to access the context value.</p><pre>function GrandchildComponent() {<br>  const user = useContext(UserContext);<br><br>  return (<br>    &lt;div&gt;Welcome, {user.name}!&lt;/div&gt;<br>  );<br>}</pre><p>With useContext(UserContext), you directly access the user object without needing to pass it through intermediate components.</p><h3>Key Differences</h3><ul><li><strong>Prop Drilling</strong>: Passing props through every level of a component tree. It can become cumbersome with deeply nested components.</li><li><strong>useContext</strong>: Allows direct access to data from anywhere in the component tree, avoiding the need for prop drilling.</li></ul><p><strong><em>Check out the entire series </em></strong><a href="https://medium.com/@anuththaraneranji/reactjs-basics-series-1f3d6be2d9a4"><strong><em>here</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78bc0f814646" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding Google Fonts to Your React Application]]></title>
            <link>https://medium.com/@anuththaraneranji/adding-google-fonts-to-your-react-application-a9aa866ae8dd?source=rss-4f04ef583aec------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9aa866ae8dd</guid>
            <dc:creator><![CDATA[NeranjiAbeysekara]]></dc:creator>
            <pubDate>Tue, 10 Sep 2024 14:43:14 GMT</pubDate>
            <atom:updated>2024-09-10T14:43:14.915Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Using Google Fonts can significantly enhance the typography of your React application. Google Fonts provides a vast collection of free, open-source fonts that you can easily integrate into your project. Here’s how to add Google Fonts to your React app in a few simple steps.</p><h3>Step-by-Step Guide</h3><h4>Choose a Font</h4><p>Visit <a href="https://fonts.google.com/">Google Fonts</a> and select a font that you like. You can filter fonts by categories, popularity, and more. For this example, let’s choose the “Roboto” font.</p><h4>Get the Embed Code</h4><p><strong>Select the Font</strong>: Click on the font you’ve chosen.</p><p><strong>Customize the Selection</strong>: Choose the styles and weights you need. Click on “Embed” in the sidebar.</p><p><strong>Copy the </strong><strong>&lt;link&gt; Tag</strong>: Google Fonts will provide a &lt;link&gt; tag that you can include in your HTML.</p><p>Example:</p><pre>&lt;link href=&quot;https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;</pre><h4>Add the Font to Your Project</h4><p>You need to include the &lt;link&gt; tag in your HTML file to make the font available in your application.</p><p><strong>Open the </strong><strong>public/index.html File</strong>: This is the main HTML file for your React app.</p><p><strong>Paste the </strong><strong>&lt;link&gt; Tag</strong>: Place the &lt;link&gt; tag inside the &lt;head&gt; section of your HTML file.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>  &lt;head&gt;<br>    &lt;meta charset=&quot;UTF-8&quot;&gt;<br>    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>    &lt;title&gt;React App&lt;/title&gt;<br>    &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;<br>  &lt;/head&gt;<br>  &lt;body&gt;<br>    &lt;div id=&quot;root&quot;&gt;&lt;/div&gt;<br>  &lt;/body&gt;<br>&lt;/html&gt;</pre><h4>Use the Font in Your CSS</h4><p>Now that the font is included in your project, you can use it in your CSS files or inline styles.</p><p><strong>In External CSS</strong>: Add the font to your CSS file.</p><p>Example App.css:</p><pre>body {<br>  font-family: &#39;Roboto&#39;, sans-serif;<br>}<br><br>h1 {<br>  font-weight: 700;<br>}<br><br>p {<br>  font-weight: 400;<br>}</pre><p><strong>Inline Styles</strong>: Apply the font directly in your component.</p><p>Example:</p><pre>import React from &#39;react&#39;;<br><br>function App() {<br>  const headerStyle = {<br>    fontFamily: &#39;Roboto, sans-serif&#39;,<br>    fontWeight: &#39;700&#39;<br>  };<br><br>  const paragraphStyle = {<br>    fontFamily: &#39;Roboto, sans-serif&#39;,<br>    fontWeight: &#39;400&#39;<br>  };<br><br>  return (<br>    &lt;div&gt;<br>      &lt;h1 style={headerStyle}&gt;Hello, World!&lt;/h1&gt;<br>      &lt;p style={paragraphStyle}&gt;This is a sample paragraph.&lt;/p&gt;<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default App;</pre><h3>Key Points</h3><ul><li><strong>Choosing a Font</strong>: Select a font from Google Fonts and customize it based on your needs.</li><li><strong>Embedding the Font</strong>: Add the provided &lt;link&gt; tag to the &lt;head&gt; section of your public/index.html file.</li><li><strong>Applying the Font</strong>: Use the font in your CSS or inline styles by specifying the font-family property.</li></ul><p><strong><em>Check out the entire series </em></strong><a href="https://medium.com/@anuththaraneranji/reactjs-basics-series-1f3d6be2d9a4"><strong><em>here</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9aa866ae8dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fetching Data from an API in React]]></title>
            <link>https://medium.com/@anuththaraneranji/fetching-data-from-an-api-in-react-0d240735a178?source=rss-4f04ef583aec------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d240735a178</guid>
            <dc:creator><![CDATA[NeranjiAbeysekara]]></dc:creator>
            <pubDate>Mon, 09 Sep 2024 12:21:40 GMT</pubDate>
            <atom:updated>2024-09-09T12:21:40.743Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Fetching data from an API is a common task in web development. With React, you can easily retrieve data from external sources and use it in your components. Let’s walk through how to do this with a simple example.</p><h3>Step-by-Step Guide</h3><p><strong>Set Up Your Component</strong></p><p>First, create a component where you want to display the data.</p><pre>import React, { useState, useEffect } from &#39;react&#39;;<br><br>function DataFetcher() {<br>  // State to hold the fetched data<br>  const [data, setData] = useState(null);<br>  // State to handle loading status<br>  const [loading, setLoading] = useState(true);<br>  // State to handle errors<br>  const [error, setError] = useState(null);<br><br>  useEffect(() =&gt; {<br>    // Fetch data when the component mounts<br>    fetch(&#39;https://api.example.com/data&#39;) // Replace with your API URL<br>      .then(response =&gt; {<br>        if (!response.ok) {<br>          throw new Error(&#39;Network response was not ok&#39;);<br>        }<br>        return response.json();<br>      })<br>      .then(data =&gt; {<br>        setData(data); // Set the data state<br>        setLoading(false); // Set loading to false<br>      })<br>      .catch(error =&gt; {<br>        setError(error); // Set error state<br>        setLoading(false); // Set loading to false<br>      });<br>  }, []); // Empty dependency array means this effect runs once on mount<br><br>  if (loading) return &lt;p&gt;Loading...&lt;/p&gt;; // Show loading message while fetching<br>  if (error) return &lt;p&gt;Error: {error.message}&lt;/p&gt;; // Show error message if there&#39;s an error<br><br>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;Data:&lt;/h1&gt;<br>      &lt;pre&gt;{JSON.stringify(data, null, 2)}&lt;/pre&gt; {/* Display data */}<br>    &lt;/div&gt;<br>  );<br>}<br><br>export default DataFetcher;</pre><h3>Key Concepts</h3><p><strong>State Management</strong>: Use useState to manage data, loading status, and error messages.</p><ul><li>data: Holds the fetched data.</li><li>loading: Indicates whether data is still being fetched.</li><li>error: Stores any error that occurs during fetching.</li></ul><p><strong>Fetching Data</strong>: Use the fetch API to request data from an endpoint. Handle the response and errors properly.</p><ul><li>fetch(&#39;https://api.example.com/data&#39;): Makes a GET request to the API.</li><li>.then(response =&gt; response.json()): Parses the response as JSON.</li><li>.catch(error =&gt; console.error(&#39;Error:&#39;, error)): Catches and logs any errors.</li></ul><p><strong>useEffect Hook</strong>: Use useEffect to perform the data fetching when the component mounts.</p><ul><li>The empty dependency array [] means the effect runs only once after the initial render.</li></ul><p><strong><em>Check out the entire series </em></strong><a href="https://medium.com/@anuththaraneranji/reactjs-basics-series-1f3d6be2d9a4"><strong><em>here</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d240735a178" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REST and SPREAD Operators in JavaScript]]></title>
            <link>https://medium.com/@anuththaraneranji/rest-and-spread-operators-in-javascript-e3224743c872?source=rss-4f04ef583aec------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3224743c872</guid>
            <dc:creator><![CDATA[NeranjiAbeysekara]]></dc:creator>
            <pubDate>Mon, 09 Sep 2024 12:18:07 GMT</pubDate>
            <atom:updated>2024-09-09T12:18:07.722Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In JavaScript, the REST and SPREAD operators are both represented by the same three dots (...), but they serve different purposes. Let’s break down what each one does and how you can use them in your code.</p><h3>SPREAD Operator</h3><p>The <strong>SPREAD</strong> operator is used to spread elements of an array or object into individual elements. It’s handy when you need to copy or combine arrays or objects.</p><h4>How the SPREAD Operator Works</h4><p><strong>Spreading Arrays</strong>: You can use the SPREAD operator to unpack elements of an array into another array or function arguments.</p><p>Example:</p><pre>const fruits = [&#39;Apple&#39;, &#39;Banana&#39;, &#39;Cherry&#39;];<br>const moreFruits = [&#39;Orange&#39;, ...fruits, &#39;Grapes&#39;];<br><br>console.log(moreFruits);<br>// Output: [&#39;Orange&#39;, &#39;Apple&#39;, &#39;Banana&#39;, &#39;Cherry&#39;, &#39;Grapes&#39;]</pre><p><strong>Spreading Objects</strong>: It can also be used to merge objects or copy properties.</p><ol><li>Here, ...person spreads the properties of the person object into the updatedPerson object.</li></ol><h3>REST Operator</h3><p>The <strong>REST</strong> operator, on the other hand, is used to collect multiple elements into an array or object. It’s useful for handling function arguments or extracting parts of an array or object.</p><h4>How the REST Operator Works</h4><p><strong>Rest in Function Parameters</strong>: Collects all remaining arguments into an array.</p><p>Example:</p><pre>function greet(greeting, ...names) {<br>  console.log(greeting);<br>  console.log(names);<br>}<br><br>greet(&#39;Hello&#39;, &#39;Alice&#39;, &#39;Bob&#39;, &#39;Charlie&#39;);<br>// Output:<br>// Hello<br>// [&#39;Alice&#39;, &#39;Bob&#39;, &#39;Charlie&#39;]</pre><p>Here, ...names collects all arguments after the first one into an array.</p><p><strong>Rest in Array Destructuring</strong>: Extracts parts of an array while collecting the rest.</p><p>Example:</p><pre>const [first, ...rest] = [1, 2, 3, 4, 5];<br><br>console.log(first);<br>// Output: 1<br>console.log(rest);<br>// Output: [2, 3, 4, 5]</pre><p>Here, first gets the first element, and ...rest collects the remaining elements into an array.</p><p><strong>Rest in Object Destructuring</strong>: Extracts parts of an object while collecting the rest.</p><p>Example:</p><pre>const person = { name: &#39;John&#39;, age: 30, city: &#39;New York&#39; };<br>const { name, ...details } = person;<br><br>console.log(name);<br>// Output: John<br>console.log(details);<br>// Output: { age: 30, city: &#39;New York&#39; }</pre><p>Here, name is extracted, and ...details collects the rest of the properties into an object.</p><h3>Key Differences</h3><ul><li><strong>SPREAD Operator</strong>: Expands elements of an array or object into separate values.</li><li><strong>REST Operator</strong>: Collects multiple values into a single array or object.</li></ul><p><strong><em>Check out the entire series </em></strong><a href="https://medium.com/@anuththaraneranji/reactjs-basics-series-1f3d6be2d9a4"><strong><em>here</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3224743c872" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>