<?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 Orfeas Voutsaridis on Medium]]></title>
        <description><![CDATA[Stories by Orfeas Voutsaridis on Medium]]></description>
        <link>https://medium.com/@orfeas_erevos?source=rss-4b60047795fc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qw1-avPz9GPpX-4phL6fMw.jpeg</url>
            <title>Stories by Orfeas Voutsaridis on Medium</title>
            <link>https://medium.com/@orfeas_erevos?source=rss-4b60047795fc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 07:08:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@orfeas_erevos/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 Frontend Developer’s Guide to Backend Performance]]></title>
            <link>https://medium.com/@orfeas_erevos/the-frontend-developers-guide-to-backend-performance-ce005f936507?source=rss-4b60047795fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce005f936507</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[backend]]></category>
            <dc:creator><![CDATA[Orfeas Voutsaridis]]></dc:creator>
            <pubDate>Mon, 07 Jul 2025 06:31:46 GMT</pubDate>
            <atom:updated>2025-07-07T06:31:46.867Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9QKoLtSSyG7zjL5plTNiw.png" /></figure><p><strong>Your UI is only as fast as your API. Here’s how to spot, diagnose, and help fix backend bottlenecks from the browser.</strong></p><p><a href="https://www.voutsaridiso.com/#/blog/OnmwGqCqcZFGYcWIkQ5o">https://www.voutsaridiso.com/#/blog/OnmwGqCqcZFGYcWIkQ5o</a></p><p>As a frontend developer, I live and breathe performance. I’ve spent countless hours optimizing React components with `React.memo`, virtualizing long lists, and meticulously code-splitting my bundles. I’ve chased down every millisecond of improvement to make the user interface feel instant. But sometimes, after all that work, the page still feels sluggish. The loading spinner just keeps spinning.</p><p>That’s when I’m reminded of a fundamental truth: **a fast frontend on a slow backend is still a slow application.**</p><p>The “it’s the API’s fault” sentiment is common, but it’s not productive. We, as frontend developers, are the first line of defense against poor performance because we are closest to the user’s experience. We don’t need to become backend experts, but by understanding how to identify performance issues, we can transform from being passive consumers of an API into invaluable collaborators. This guide will empower you to go from saying “the API is slow” to “the API is slow, and I think I know why.”</p><h3><strong>Why You, the Frontend Dev, Should Care</strong></h3><p>Backend performance directly impacts the frontend metrics we already obsess over:</p><ul><li><strong>Time to First Byte (TTFB): </strong>This metric is almost purely a measure of how long the server takes to think before sending back the first piece of data. A high TTFB is a direct signal of a slow backend process.</li><li><strong>Largest Contentful Paint (LCP):</strong> If the largest element on your page is data-driven — like a user’s profile banner or the main article text — a slow API call will directly delay your LCP, hurting your Core Web Vitals score.</li><li><strong>Time to Interactive (TTI):</strong> A user can’t meaningfully interact with a page until the necessary data has arrived and been rendered. Long-running API calls are a primary cause of high TTI.</li></ul><p>Our goal isn’t to point fingers; it’s to build better products. By understanding the backend’s impact, we can provide actionable feedback that helps the entire team win.</p><h3>Your Primary Tool: Mastering the Browser’s Network Tab</h3><p>Your browser’s developer tools are your best friend. The Network tab, in particular, holds the clues to most performance mysteries. Here’s what to look for:</p><p><strong>Reading the Waterfall:</strong></p><p>When you select an API request, the “Timing” tab shows a waterfall chart. Two bars are critical:</p><p>- <strong>Waiting (TTFB) — The Green Bar</strong>: This is server think-time. A long green bar means your request arrived quickly, but the server took a long time to process it and start sending a response.</p><p>- <strong>Content Download — The Blue Bar:</strong> This is transfer time. A long blue bar means the server responded quickly, but the data payload was so large that it took a long time to download.</p><p><strong>Spotting Patterns:</strong></p><ul><li>The Request Chain: One API call only starts after the previous one finishes. This creates a waterfall of requests, each one adding to the total load time. This is a classic sign of under-fetching.</li><li>The Swarm of Requests: The page makes dozens of small, simultaneous requests to render. This often points to an <strong>N+1 query</strong> problem on the backend.</li></ul><h3>Common Backend Bottlenecks (And How They Look from the Frontend)</h3><p>Now, let’s translate those network tab symptoms into common backend issues.</p><p><strong>A. The Bloated Payload (Over-fetching)</strong></p><ul><li><strong>Backend Problem:</strong> The API endpoint (e.g., `/api/users/123`) sends back the entire user object with 50 fields, including data your component doesn’t need.</li><li><strong>Frontend Symptom:</strong> A long <strong>”Content Download</strong>” time (the blue bar). You inspect the response and realize your component only needed `user.name` and `user.avatarUrl`, but you received 2MB of data.</li><li><strong>How to Help: </strong>“Hey team, I noticed the `/users` endpoint sends the full user object. Our new profile card only uses 3 fields. Could we create a leaner endpoint or use something like GraphQL to let the client specify the data it needs? It would significantly cut down our load time.”</li></ul><p><strong>B. The Chatty API (Under-fetching)</strong></p><ul><li><strong>Backend Problem:</strong> The application architecture requires you to make multiple, sequential calls to render a single, cohesive view.</li><li><strong>Frontend Symptom:</strong> You see a request waterfall in the Network tab: `GET /posts/1` finishes, then `GET /users/5` (for the author) kicks off, and finally `GET /posts/1/comments` begins.</li><li><strong>How to Help:</strong> “To render the post page, I have to make three sequential API calls, which is delaying our TTI. Could we explore getting a single endpoint, maybe `/api/posts/1/details`, that returns the post with the author and comments embedded?”</li></ul><p><strong>C. The N+1 Query Problem</strong></p><ul><li><strong>Backend Problem:</strong> This is a sneaky one. The server gets a list of 10 items (the “1” query), then loops through them and makes a separate database query for each item’s details (the “N” queries).</li><li><strong>Frontend Symptom:</strong> You see a swarm of individual requests (e.g., 10 calls to `/api/users/:id` after getting a list of 10 posts). Alternatively, a single call to `/api/posts` might just be very slow, with a high TTFB, because the server is doing the N+1 work internally before responding.</li><li><strong>How to Help:</strong> “When fetching the list of articles, the TTFB seems to get progressively slower as we add more articles to the list. This might be an N+1 query issue on the backend. Can we check if the author data can be eager-loaded in a single database query?”</li></ul><h3>D. The Slow, Complex Query</h3><ul><li><strong>Backend Problem:</strong> A single API endpoint is backed by a highly complex database query, a table with no index, or heavy data processing that takes a long time to complete.</li><li><strong>Frontend Symptom:</strong> A single API call has an extremely high **TTFB** (the green bar), even with a small payload. The download is fast, but the wait is long.</li><li><strong>How to Help:</strong> “The `/api/analytics/report` endpoint consistently takes 5–7 seconds to respond. The payload is small, so the delay is happening on the server. Could we investigate the database query or business logic for that endpoint to see if it can be optimized?”</li></ul><h3>From Diagnosis to Actionable Collaboration</h3><p>The key to success is how you communicate your findings.</p><p>1. <strong>Gather Evidence:</strong> Come to the backend team with data, not just complaints. Take screenshots of the network tab waterfall. Use the performance profiler.<br>2. <strong>Speak the Language:</strong> Use the terms we’ve discussed. Saying “I think we have an over-fetching issue” is far more productive than “this is slow.”<br>3. <strong>Propose Solutions (From Your Perspective): </strong>You can be part of the solution by suggesting patterns like pagination, proposing changes to the API response shape, or even starting a conversation about adopting a <strong>Backend for Frontend (BFF)</strong> pattern or exploring <strong>GraphQL</strong>.</p><h3>Conclusion: Building Better Products, Together</h3><p>A frontend developer who understands these backend performance patterns is a force multiplier. You can catch issues earlier, facilitate more productive conversations, and contribute to a faster, more resilient application for everyone.</p><p>So next time you’re faced with a mysterious loading spinner, don’t just sigh. Open your Network tab and start investigating. You might be surprised by the stories your APIs are telling you. True performance is a team sport, built on a foundation of shared ownership of the user experience — from the database all the way to the DOM.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce005f936507" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular vs. React vs. Next.js: A Developer’s Perspective on Choosing the Right Tool]]></title>
            <link>https://medium.com/@orfeas_erevos/angular-vs-react-vs-next-js-a-developers-perspective-on-choosing-the-right-tool-f12f20c8cfbf?source=rss-4b60047795fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/f12f20c8cfbf</guid>
            <category><![CDATA[anguar]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Orfeas Voutsaridis]]></dc:creator>
            <pubDate>Thu, 03 Jul 2025 05:18:36 GMT</pubDate>
            <atom:updated>2025-07-03T05:34:52.893Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fy3fOnt3-3ixMqgib6WScg.png" /></figure><p><a href="https://www.voutsaridiso.com/#/blog/7XhjujRmucM7EkbC2uY4">Orfeas Voutsaridis</a></p><p>As a software engineer who’s spent years crafting user interfaces, I’ve had the opportunity to dive deep into several popular frontend technologies. Among them, Angular, React, and Next.js stand out as powerful choices, each with its own strengths and ideal use cases. While they all aim to build dynamic web applications, understanding their core philosophies and how they fit into different project scenarios is crucial for making the right decision.</p><p>In this post, I’ll share my practical experience and insights on when to choose Angular, when React shines, and why Next.js has become a go-to for many modern applications.</p><h3>React: The Flexible Foundation</h3><p><strong>What it is:</strong> React is a JavaScript library for building user interfaces, developed by Facebook. It’s known for its component-based architecture, virtual DOM for efficient updates, and declarative programming style.</p><p><strong>Key Strengths:</strong></p><ul><li><strong>Component Reusability</strong>: Encourages breaking down UIs into small, manageable, and reusable components.</li><li><strong>Virtual DOM:</strong> Leads to better performance by minimizing direct DOM manipulation.</li><li><strong>Vast Ecosystem</strong>: A huge community, tons of libraries, and extensive documentation.</li><li><strong>Flexibility</strong>:You can choose your own routing, state management, and build tools.</li></ul><p><strong>When to Prefer React:</strong></p><ul><li><strong>Single-Page Applications (SPAs) with complex UIs</strong>: If you’re building an application where the user experience is highly interactive and dynamic, React’s component model excels. Think dashboards, admin panels, or complex data visualization tools.</li><li><strong>Projects requiring high customization:</strong> When you want granular control over every aspect of your application’s architecture (routing, state management, build processes), React provides that freedom.</li><li><strong>Mobile App Development (React Native):</strong> If there’s a possibility of extending your web application to a mobile platform, React’s underlying principles translate well to React Native, allowing for code sharing and a familiar development paradigm.</li></ul><p><strong>You have a team already proficient in JavaScript/ES6+:</strong> React is generally easier to pick up for developers with a strong JavaScript background.</p><p><strong>Example Use Cases:</strong></p><ul><li>E-commerce product catalogs with dynamic filtering and sorting.</li><li>Social media feeds with real-time updates.</li><li>Interactive data dashboards.</li><li>Web applications where the UI is the primary focus and the backend is relatively simple or a separate microservice.</li></ul><h3>Angular: The Comprehensive Framework</h3><p><strong>What it is: </strong>Angular is a full-fledged framework for building large-scale, enterprise-level applications, developed by Google. It provides a structured, opinionated approach with a built-in set of tools for routing, state management, HTTP requests, and more.</p><p><strong>Key Strengths:</strong></p><ul><li><strong>Opinionated Structure:</strong> Offers a clear way to organize code, making it easier for teams to collaborate on large projects.</li><li><strong>TypeScript First:</strong> Built with TypeScript, providing static typing for enhanced code quality and maintainability.</li><li><strong>All-in-One Solution: </strong>Includes solutions for routing, state management (RxJS), HTTP client, and forms out-of-the-box.</li><li><strong>Enterprise-Ready:</strong> Its robustness and structure make it suitable for complex, long-term projects.</li></ul><p><strong>When to Prefer Angular:</strong></p><ul><li><strong>Large-Scale Enterprise Applications: </strong>When building complex applications with many features, long development cycles, and a need for strict architectural guidelines, Angular’s comprehensive nature is a significant advantage.</li><li><strong>Teams familiar with TypeScript and Object-Oriented Programming (OOP):</strong> Developers coming from OOP backgrounds or those who value strong typing will find Angular’s approach intuitive.</li><li><strong>Projects requiring a standardized development process:</strong> Angular’s opinionated nature ensures consistency across the codebase, which is invaluable for team onboarding and maintainability.</li><li><strong>When you need built-in solutions for common patterns:</strong> If you prefer not to spend time choosing and integrating separate libraries for routing or state management, Angular’s integrated solutions are a big plus.</li></ul><p><strong>Example Use Cases:</strong></p><ul><li>Complex enterprise resource planning (ERP) systems.</li><li>Financial management applications.</li><li>Customer relationship management (CRM) platforms.</li><li>Large content management systems (CMS) with extensive administrative interfaces.</li></ul><h3>Next.js: The React Framework for Production</h3><p><strong>What it is: </strong>Next.js is a React framework that enables server-side rendering (SSR), static site generation (SSG), and more, making it ideal for performance and SEO. It’s built by Vercel.</p><p><strong>Key Strengths:</strong></p><p><strong>Hybrid Rendering:</strong> Supports SSR, SSG, ISR (Incremental Static Regeneration), and client-side rendering (CSR), offering unparalleled flexibility for performance and SEO.<br><strong>File-Based Routing: </strong>Simplifies route creation by mapping files in the `pages` directory to routes.<br><strong>API Routes</strong> Allows you to build backend APIs directly within your Next.js project.<br><strong>Optimized for Performance:</strong> Built-in image optimization, code splitting, and prefetching contribute to fast loading times.<br><strong>Developer Experience:</strong> Features like fast refresh and zero-config setup enhance productivity.</p><p><strong>When to Prefer Next.js:</strong></p><p><strong>SEO-Critical Applications:</strong> If your application needs to be easily discoverable by search engines, Next.js’s SSR and SSG capabilities are invaluable.<br><strong>Content-Heavy Websites:</strong> Blogs, marketing sites, e-commerce product pages, and documentation sites benefit greatly from the performance and SEO advantages of SSG and ISR.<br><strong>Full-Stack Applications with a React Frontend:</strong> The ability to build API routes within the same project streamlines development for smaller to medium-sized applications.<br><strong>Performance-Oriented Applications: </strong>When fast initial load times and smooth navigation are paramount.<br><strong>Jamstack Architecture</strong>: Fits perfectly into the Jamstack approach, combining static site generation with dynamic content delivery.</p><p><strong>Example Use Cases:</strong></p><ul><li>E-commerce storefronts.</li><li>Company blogs and marketing websites.</li><li>News portals.</li><li>SaaS applications where initial load performance is critical.</li><li>Projects that need to leverage server-side logic without setting up a separate backend framework from scratch.</li></ul><h3>Putting It All Together: When to Choose What</h3><p><strong>Start with React</strong> if: You need maximum flexibility, are building a highly interactive SPA, or plan to develop a mobile app concurrently.</p><p><strong>Choose Angular</strong> if: You’re building a large-scale enterprise application, value a structured and opinionated framework, and your team is comfortable with TypeScript and OOP.</p><p><strong>Opt for Next.js </strong>if: SEO and performance are top priorities, you need hybrid rendering capabilities (SSR, SSG), or you want to build a full-stack React application with built-in API routes.</p><p>It’s also worth noting that Next.js <strong>is</strong> a React framework. This means if you’re already comfortable with React, migrating to Next.js for its rendering and routing benefits is a natural progression.</p><p>Ultimately, the “best” tool is the one that best fits your project’s requirements, your team’s expertise, and your long-term goals. I encourage you to experiment with each and see firsthand how they feel in practice!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f12f20c8cfbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Power of React 19: 10 Best Practices for Modern Development]]></title>
            <link>https://javascript.plainenglish.io/unlocking-the-power-of-react-19-10-best-practices-for-modern-development-fcbc28a348a5?source=rss-4b60047795fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/fcbc28a348a5</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Orfeas Voutsaridis]]></dc:creator>
            <pubDate>Mon, 30 Jun 2025 05:03:49 GMT</pubDate>
            <atom:updated>2025-07-01T00:58:14.349Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J4X08OyV89GxPPKVMAaJyg.png" /></figure><p>React 19 is here, and it’s more than just an incremental update — it’s a paradigm shift. With the introduction of the React Compiler, Actions, and a suite of new hooks, the way we write performant and user-friendly applications has fundamentally evolved.</p><p>For years, we’ve manually optimized our apps with `useMemo`, `useCallback`, and complex state management for asynchronous operations. React 19 automates much of this, allowing us to focus on what truly matters: building great features with cleaner, more declarative code.</p><p>Here are 10 best practices to help you and your team leverage the full potential of React 19 in your next project.</p><p><strong>1. Trust the Compiler: Write Simpler Code</strong></p><p>The single biggest change in React 19 is the **React Compiler**. It’s an optimizing compiler that automatically memoizes components and hooks. This means you no longer need to manually wrap functions in `useCallback` or values in `useMemo` to prevent unnecessary re-renders.</p><p><strong>Old Way (Pre-Compiler):</strong></p><pre>import { useCallback, useState } from &quot;react&quot;;<br>function OldComponent({ data }) {<br> const [text, setText] = useState(&quot;&quot;);<br>// Manually memoized to prevent re-creating the function on each render<br> const handleClick = useCallback(() =&gt; {<br> console.log(&quot;Clicked with data:&quot;, data);<br> }, [data]);<br>return (<br> &lt;div&gt;<br> &lt;input<br> type=&quot;text&quot;<br> value={text}<br> onChange={(e) =&gt; setText(e.target.value)}<br> /&gt;<br> &lt;MyButton onClick={handleClick} /&gt;<br> &lt;/div&gt;<br> );<br>}</pre><p><strong>React 19 Way (With Compiler):</strong></p><pre>import { useState } from &quot;react&quot;;<br>// The compiler handles memoization automatically!<br>function NewComponent({ data }) {<br> const [text, setText] = useState(&quot;&quot;);<br>// Just a regular function. The compiler optimizes it.<br> const handleClick = () =&gt; {<br> console.log(&quot;Clicked with data:&quot;, data);<br> };<br>return (<br> &lt;div&gt;<br> &lt;input<br> type=&quot;text&quot;<br> value={text}<br> onChange={(e) =&gt; setText(e.target.value)}<br> /&gt;<br> &lt;MyButton onClick={handleClick} /&gt;<br> &lt;/div&gt;<br> );<br>}</pre><p><strong>Best Practice:</strong> Write straightforward JavaScript and let the compiler handle performance optimization. Only reach for manual memoization in the rare edge cases where the compiler might need a hint.</p><p><strong>2. Embrace Actions for Data Mutations</strong></p><p>Handling form submissions and data mutations has always involved boilerplate for managing pending, error, and success states. **Actions** streamline this entire process. You can pass a function (often an async `serverAction`) directly to a `&lt;form&gt;`’s `action` prop.</p><pre>// actions.js<br>&quot;use server&quot;; // For server actions with frameworks like Next.js<br>export async function updateUser(userId, formData) {<br> const name = formData.get(&quot;name&quot;);<br> // … logic to update user in the database<br> // This can throw an error or return data<br>}</pre><pre>// ProfilePage.jsx<br>import { updateUser } from &quot;./actions&quot;;<br>function ProfilePage({ userId }) {<br> // Bind the userId to the server action<br> const updateUserWithId = updateUser.bind(null, userId);<br>return (<br> &lt;form action={updateUserWithId}&gt;<br> &lt;label htmlFor=&quot;name&quot;&gt;Name:&lt;/label&gt;<br> &lt;input type=&quot;text&quot; id=&quot;name&quot; name=&quot;name&quot; /&gt;<br> &lt;button type=&quot;submit&quot;&gt;Update&lt;/button&gt;<br> &lt;/form&gt;<br> );<br>}</pre><p><strong>Best Practice:</strong> Use Actions for any form submission or data mutation. This simplifies state management and automatically handles pending states.</p><p><strong>3. Enhance UX with `useOptimistic`</strong></p><p>Optimistic updates dramatically improve perceived performance. The `useOptimistic` hook lets you immediately show the result of an action before the server confirms it. If the action fails, the UI automatically reverts.</p><pre>import { useOptimistic } from &quot;react&quot;;<br>import { sendComment } from &quot;./actions&quot;;<br>function Comments({ comments }) {<br> const [optimisticComments, addOptimisticComment] = useOptimistic(<br> comments,<br> (state, newComment) =&gt; […state, { text: newComment, sending: true }],<br> );<br>const formAction = async (formData) =&gt; {<br> const newComment = formData.get(&quot;comment&quot;);<br> addOptimisticComment(newComment);<br> await sendComment(newComment);<br> };<br>return (<br> &lt;div&gt;<br> &lt;ul&gt;<br> {optimisticComments.map((c, i) =&gt; (<br> &lt;li key={i}&gt;<br> {c.text} {c.sending &amp;&amp; &lt;small&gt;(Sending…)&lt;/small&gt;}<br> &lt;/li&gt;<br> ))}<br> &lt;/ul&gt;<br> &lt;form action={formAction}&gt;<br> &lt;input type=&quot;text&quot; name=&quot;comment&quot; /&gt;<br> &lt;button type=&quot;submit&quot;&gt;Send&lt;/button&gt;<br> &lt;/form&gt;<br> &lt;/div&gt;<br> );<br>}</pre><p><strong>Best Practice:</strong> Pair `useOptimistic` with Actions to give users instant feedback on their interactions.</p><p><strong>4. Decouple Forms with `useFormStatus`</strong></p><p>How does a submit button know it should be disabled or show “Submitting…”? Previously, this required prop drilling or context. The `useFormStatus` hook lets a component inside a `&lt;form&gt;` access the status of that form.</p><pre>import { useFormStatus } from &quot;react-dom&quot;;<br>function SubmitButton() {<br> const { pending } = useFormStatus();<br>return (<br> &lt;button type=&quot;submit&quot; disabled={pending}&gt;<br> {pending ? &quot;Submitting…&quot; : &quot;Submit&quot;}<br> &lt;/button&gt;<br> );<br>}<br>// Used inside any &lt;form&gt;<br>function MyForm() {<br> return (<br> &lt;form action={someAction}&gt;<br> &lt;input name=&quot;field&quot; /&gt;<br> &lt;SubmitButton /&gt;<br> &lt;/form&gt;<br> );<br>}</pre><p>**Best Practice:** Use `useFormStatus` to create reusable, decoupled UI components (like buttons and spinners) that react to form state without receiving any props.</p><p><strong>5. Simplify Async Logic with the `use` Hook</strong></p><p>The `use` hook is a powerful new way to read the value of a promise or context within a component. When used with a promise inside a `&lt;Suspense&gt;` boundary, it makes asynchronous data fetching look synchronous.</p><pre>import { Suspense, use } from &quot;react&quot;;<br>// Assume fetchUserData returns a promise<br>const userDataPromise = fetchUserData();<br>function ProfileDetails() {<br> // The component will &quot;suspend&quot; here until the promise resolves<br> const user = use(userDataPromise);<br> return &lt;h1&gt;{user.name}&lt;/h1&gt;;<br>}<br>function ProfilePage() {<br> return (<br> &lt;Suspense fallback={&lt;h2&gt;Loading profile…&lt;/h2&gt;}&gt;<br> &lt;ProfileDetails /&gt;<br> &lt;/Suspense&gt;<br> );<br>}</pre><p><strong>Best Practice:</strong> In Suspense-enabled data fetching patterns, prefer `use(promise)` over `useEffect` and `useState` for cleaner, more readable async code.</p><p><strong>6. Think in Server Components (with Frameworks)</strong></p><p>While not part of the React library itself, React 19 is built with Server Components in mind. Frameworks like Next.js make them a core part of the architecture. Server Components run on the server, have zero impact on your client-side bundle size, and can access backend resources directly.</p><pre>// app/page.js in Next.js - This is a Server Component by default<br>async function getProducts() {<br> const res = await db.query(&quot;SELECT * FROM products&quot;);<br> return res.rows;<br>}<br>export default async function HomePage() {<br> const products = await getProducts();<br>return (<br> &lt;main&gt;<br> &lt;h1&gt;Our Products&lt;/h1&gt;<br> &lt;ProductList products={products} /&gt;<br> &lt;/main&gt;<br> );<br>}</pre><p><strong>Best Practice:</strong> For static content and initial data fetching, default to Server Components. Use Client Components (`”use client”`) only when you need interactivity, state, or browser-only APIs.</p><p><strong>7. Prioritize Component Composition</strong></p><p>This is a timeless React principle, but it’s more important than ever. With the compiler reducing the need for complex hooks, we can focus on building small, reusable components that are composed together using the `children` prop.</p><pre>// A reusable Card component that knows nothing about its content<br>function Card({ children, title }) {<br> return (<br> &lt;div className=&quot;card&quot;&gt;<br> &lt;h2&gt;{title}&lt;/h2&gt;<br> &lt;div className=&quot;card-content&quot;&gt;{children}&lt;/div&gt;<br> &lt;/div&gt;<br> );<br>}<br>// Composing it to build a specific feature<br>function UserProfile({ user }) {<br> return (<br> &lt;Card title={user.name}&gt;<br> &lt;p&gt;Email: {user.email}&lt;/p&gt;<br> &lt;p&gt;Member since: {user.joinDate}&lt;/p&gt;<br> &lt;/Card&gt;<br> );<br>}</pre><p><strong>Best Practice:</strong> Build small, single-responsibility components. Use the `children` prop to create flexible and reusable layouts and containers.</p><p><strong>8. Adopt a Scalable Project Structure</strong></p><p>As projects grow, a well-organized file structure is crucial. Instead of grouping files by type (`/components`, `/hooks`), group them by feature or domain. This co-locates related logic, making it easier to navigate and maintain.</p><pre>/src<br> /features<br> /authentication<br> - LoginButton.jsx<br> - auth.actions.js<br> - useAuthStatus.js<br> - index.js<br> /products<br> - ProductList.jsx<br> - ProductCard.jsx<br> - products.actions.js<br> - index.js<br> /components // (For truly shared, generic components)<br> - Button.jsx<br> - Card.jsx</pre><p><strong>Best Practice:</strong> Organize your code by feature. This makes your codebase more modular and easier to reason about as it scales.</p><p><strong>9. Integrate TypeScript from Day One</strong></p><p>React 19’s new APIs, especially Actions, have excellent TypeScript support. Starting a project with TypeScript catches bugs before they happen, improves autocompletion, and makes refactoring safer. Given your backend experience with Node.js, you’ll appreciate the type safety across your full stack.</p><p><strong>Best Practice:</strong> Use TypeScript in all new React projects. It’s the industry standard for building robust, maintainable applications.</p><p><strong>10. Write Meaningful, User-Centric Tests</strong></p><p>Focus your tests on how a user interacts with your application, not on the internal implementation details. With the compiler changing how your components are optimized, testing implementation is more brittle than ever.</p><pre>import { render, screen } from &quot;@testing-library/react&quot;;<br>import userEvent from &quot;@testing-library/user-event&quot;;<br>import MyForm from &quot;./MyForm&quot;;<br><br>test(&quot;form submits and shows a success message&quot;, async () =&gt; {<br> render(&lt;MyForm /&gt;);<br>// Simulate user typing into the input<br> await userEvent.type(screen.getByLabelText(/name/i), &quot;Orfeas&quot;);<br>// Simulate user clicking the submit button<br> await userEvent.click(screen.getByRole(&quot;button&quot;, { name: /submit/i }));<br>// Assert that the success message appears<br> expect(await screen.findByText(/thank you/i)).toBeInTheDocument();<br>});</pre><p><strong>Best Practice</strong>:Use tools like React Testing Library and Vitest/Jest to write tests that simulate real user behavior. Test what the user sees and does, not the component’s internal state.</p><p>— —</p><p><strong>Conclusion</strong></p><p>React 19 invites us to write less code to achieve more. By embracing the compiler, using the new action-oriented hooks, and thinking in terms of server-first architecture, we can build faster, more resilient applications with a significantly improved developer experience.</p><p>Happy coding</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fcbc28a348a5" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/unlocking-the-power-of-react-19-10-best-practices-for-modern-development-fcbc28a348a5">Unlocking the Power of React 19: 10 Best Practices for Modern Development</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Level Up Your TypeScript: 10 Best Practices You Should Be Using]]></title>
            <link>https://javascript.plainenglish.io/level-up-your-typescript-10-best-practices-you-should-be-using-4d4f30392090?source=rss-4b60047795fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d4f30392090</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[best-practices]]></category>
            <dc:creator><![CDATA[Orfeas Voutsaridis]]></dc:creator>
            <pubDate>Thu, 26 Jun 2025 05:47:48 GMT</pubDate>
            <atom:updated>2025-07-08T00:17:00.742Z</atom:updated>
            <content:encoded><![CDATA[<p>Go beyond basic annotations and harness TypeScript’s powerful utility types to write cleaner, safer, and more maintainable code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0g2p_9s8j_Vmaj9zrzifEw.png" /></figure><p>TypeScript is more than just JavaScript with types. It’s a powerful toolset that, when used correctly, can dramatically improve your code’s quality, maintainability, and reliability. Moving beyond basic type annotations like `string` and `number` is the key to unlocking its true potential.</p><p>Are you writing code that is not just type-safe but also clean, reusable, and self-documenting?</p><p>Let’s dive into 10 best practices, focusing on TypeScript’s powerful utility types, complete with “bad” and “good” examples to make the benefits crystal clear.</p><p><strong>1. Avoid `any`, Embrace `unknown`</strong></p><p>Using `any` is like turning off the seatbelt warning in your car — it silences the compiler, but you lose all the safety benefits. The `unknown` type is the type-safe alternative. It forces you to perform type checks before you can use the variable.</p><p>👎 Bad: Using `any` disables all type checking.</p><pre>function processData(data: any) {<br> // No errors here, but this could crash at runtime if `data` is not a string.<br> console.log(data.toUpperCase()); <br>}</pre><p>👍 Good: Using `unknown` forces you to validate the type.</p><pre>function processData(data: unknown) {<br> // This is a type-safe check.<br> if (typeof data === &#39;string&#39;) {<br> // TypeScript now knows `data` is a string inside this block.<br> console.log(data.toUpperCase());<br> } else {<br> console.log(&quot;Data is not a string.&quot;);<br> }<br>}</pre><p><strong>2. Leverage Type Inference</strong></p><p>TypeScript is smart! You don’t always need to explicitly declare the type of a variable if it can be inferred from its initial value. Over-annotating adds noise and makes the code harder to read.</p><p>👎 Bad: Redundant type annotation.</p><pre>let name: string = &quot;Alice&quot;;<br>let age: number = 30;<br>let isActive: boolean = true;</pre><p>👍 Good: Let TypeScript do the work.</p><pre>let name = &quot;Alice&quot;; // Inferred as `string`<br>let age = 30; // Inferred as `number`<br>let isActive = true; // Inferred as `boolean`</pre><p><strong>3. Prefer String Literal Unions over Enums</strong></p><p>While `enum` has its uses, it adds extra generated code to your JavaScript bundle and can have some surprising behavior. A simple union of string literals is often more lightweight, predictable, and easier to debug.</p><p>👎 Bad: Using an `enum` can be verbose and less transparent.</p><pre>enum Status {<br> PENDING, // Defaults to 0<br> SHIPPED, // Defaults to 1<br> DELIVERED // Defaults to 2<br>}<br>function checkStatus(status: Status) { /* … */ }<br>checkStatus(Status.PENDING); // You&#39;d see `0` in your logs</pre><p>👍 Good: A string literal union is simple and clear.</p><pre>type Status = &#39;pending&#39; | &#39;shipped&#39; | &#39;delivered&#39;;<br>function checkStatus(status: Status) { /* … */ }<br>checkStatus(&#39;pending&#39;); // You&#39;d see &#39;pending&#39; in your logs, much easier to debug!</pre><p><strong>4. Use `Partial&lt;T&gt;` for Updates</strong></p><p>Don’t manually create a new type for update payloads where every property is optional. `Partial&lt;T&gt;` is a utility type that takes a type `T` and makes all its properties optional. This is the epitome of the DRY (Don’t Repeat Yourself) principle.</p><p>👎 Bad: Manually defining a partial type.</p><pre>interface User {<br> id: number;<br> name: string;<br> email: string;<br>}<br>interface UserUpdatePayload {<br> name?: string;<br> email?: string;<br>}<br>function updateUser(id: number, payload: UserUpdatePayload) { /* … */ }</pre><p>👍 Good: Using `Partial&lt;T&gt;` to generate the type automatically.</p><pre>interface User {<br> id: number;<br> name: string;<br> email: string;<br>}<br>// `Partial&lt;User&gt;` is equivalent to: { id?: number; name?: string; email?: string; }<br>function updateUser(id: number, payload: Partial&lt;User&gt;) { /* … */ }</pre><p><strong>5. Use `Pick&lt;T, K&gt;` to Create Subsets</strong></p><p>When you only need a few properties from a large object type, use `Pick&lt;T, K&gt;` to create a new type containing only the properties (`K`) you want from the original type (`T`).</p><p>👎 Bad: Redefining types for different contexts.</p><pre>interface User {<br> id: number;<br> name: string;<br> email: string;<br> createdAt: Date;<br>}<br>interface UserDisplay {<br> name: string;<br> email: string;<br>}<br>function displayUser(user: UserDisplay) { /* … */ }</pre><p>👍 Good: `Pick`ing the properties you need.</p><pre>interface User {<br> id: number;<br> name: string;<br> email: string;<br> createdAt: Date;<br>}<br>// Creates a type with only the &#39;name&#39; and &#39;email&#39; properties from User.<br>type UserDisplay = Pick&lt;User, &#39;name&#39; | &#39;email&#39;&gt;;<br>function displayUser(user: UserDisplay) { /* … */ }</pre><p><strong>6. Use `Omit&lt;T, K&gt;` for Exclusions</strong></p><p>`Omit&lt;T, K&gt;` is the opposite of `Pick`. It creates a new type by taking all properties from `T` and then *removing* the ones you specify in `K`. This is perfect for when you want “everything but…”.</p><p>👎 Bad: Manually creating a type without certain properties.</p><pre>interface User {<br> id: number;<br> name: string;<br> passwordHash: string; // We don&#39;t want to send this to the client!<br>}<br>interface UserForClient {<br> id: number;<br> name: string;<br>}</pre><p>👍 Good: Using `Omit` to create a safe DTO (Data Transfer Object).</p><pre>interface User {<br> id: number;<br> name: string;<br> passwordHash: string;<br>}<br>// Creates a type with all properties from User *except* &#39;passwordHash&#39;.<br>type UserForClient = Omit&lt;User, &#39;passwordHash&#39;&gt;;</pre><p>This is more maintainable because if you add a new field to `User`, it’s automatically included in `UserForClient`.</p><p><strong>7. Use `Record&lt;K, T&gt;` for Dictionaries</strong></p><p>When creating an object to be used as a dictionary or map, avoid `{[key: string]: any}`. Use `Record&lt;Keys, Type&gt;` for a fully-typed object, where `Keys` is a union of your allowed keys and `Type` is the type of the value.</p><p>👎 Bad: A loose object type that allows any string key.</p><pre>const featureFlags: { [key: string]: boolean } = {<br> &#39;new-dashboard&#39;: true,<br> &#39;beta-feature&#39;: false,<br> &#39;some-typo&#39;: true, // A typo like this would be allowed<br>};</pre><p>👍 Good: Using `Record` for strict key and value typing.</p><pre>type Feature = &#39;new-dashboard&#39; | &#39;beta-feature&#39; | &#39;user-profile-v2&#39;;<br>const featureFlags: Record&lt;Feature, boolean&gt; = {<br> &#39;new-dashboard&#39;: true,<br> &#39;beta-feature&#39;: false,<br> &#39;user-profile-v2&#39;: true,<br> // &#39;some-typo&#39;: true, // Error! Object literal may only specify known properties.<br>};</pre><p><strong>8. Use `ReturnType&lt;T&gt;` to Avoid Repetition</strong></p><p>Don’t manually define a type for something that is already implicitly defined by a function’s return value. The `ReturnType&lt;T&gt;` utility type extracts the return type of a function type `T`.</p><p>👎 Bad: Manually defining a state type that might get out of sync.</p><pre>function createAuthStore() {<br> return {<br> isLoggedIn: false,<br> user: null as { name: string } | null,<br> };<br>}<br>// Manually typed, could become incorrect if createAuthStore changes.<br>type AuthState = {<br> isLoggedIn: boolean;<br> user: { name: string } | null;<br>};</pre><p>👍 Good: Deriving the type directly from the function.</p><pre>function createAuthStore() {<br> return {<br> isLoggedIn: false,<br> user: null as { name: string } | null,<br> };<br>}<br>// AuthState will always be perfectly in sync with what the function returns.<br>type AuthState = ReturnType&lt;typeof createAuthStore&gt;;</pre><p><strong>9. Create Immutable Types with `as const`</strong></p><p>When you have a configuration object or a set of constants that should never change, use an `as const` assertion. This tells TypeScript to infer the most specific type possible and makes all properties `readonly`.</p><p>👎 Bad: A regular object with wide, mutable types.</p><pre>const config = {<br> theme: &#39;dark&#39;, // Type is `string`<br> version: 1, // Type is `number`<br>};<br>config.theme = &#39;light&#39;; // This is allowed, which might be a bug.</pre><p>👍 Good: An immutable object with literal types.</p><pre>const config = {<br> theme: &#39;dark&#39;,<br> version: 1,<br>} as const;<br>// config.theme = &#39;light&#39;; // Error! Cannot assign to &#39;theme&#39; because it is a read-only property.<br>// The inferred type of `config.theme` is the literal &#39;dark&#39;, not the general `string`.</pre><p><strong>10. Write Reusable Code with Generics</strong></p><p>Generics are the foundation of reusable, type-safe components and functions. Instead of writing separate functions for different but structurally similar types, write one generic function.</p><p>👎 Bad: Duplicate functions for different types.</p><pre>interface User { id: number; name: string; }<br>interface Product { id: number; price: number; }<br>function findUserById(items: User[], id: number): User | undefined {<br> return items.find(item =&gt; item.id === id);<br>}<br>function findProductById(items: Product[], id: number): Product | undefined {<br> return items.find(item =&gt; item.id === id);<br>}</pre><p>👍 Good: A single, reusable generic function.</p><pre>interface Entity {<br> id: number;<br>}<br>// This function works with any object type that has an `id` property.<br>function findById&lt;T extends Entity&gt;(items: T[], id: number): T | undefined {<br> return items.find(item =&gt; item.id === id);<br>}<br>// Can be used for Users, Products, or any other entity.<br>const user = findById(users, 1);<br>const product = findById(products, 42);</pre><p><strong>Conclusion</strong></p><p>Embracing these practices will transform your TypeScript code. You’ll move from simply satisfying the compiler to actively leveraging its features to build more robust, maintainable, and elegant applications. Start by picking one or two of these tips and incorporating them into your next project — you’ll see the benefits immediately.</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d4f30392090" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/level-up-your-typescript-10-best-practices-you-should-be-using-4d4f30392090">Level Up Your TypeScript: 10 Best Practices You Should Be Using</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supercharge Your Angular 17+ Testing with Jest: A Modern Configuration Guide]]></title>
            <link>https://javascript.plainenglish.io/supercharge-your-angular-17-testing-with-jest-a-modern-configuration-guide-0350087eac22?source=rss-4b60047795fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/0350087eac22</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[jest]]></category>
            <category><![CDATA[testing-tools]]></category>
            <dc:creator><![CDATA[Orfeas Voutsaridis]]></dc:creator>
            <pubDate>Mon, 23 Jun 2025 05:36:50 GMT</pubDate>
            <atom:updated>2025-06-24T00:10:24.882Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qqvh6Ecke1-2sOFkid5jUQ.jpeg" /></figure><p><a href="https://www.voutsaridiso.com/#/blog/ysZepzLRLwBmohAQffHs">https://www.voutsaridiso.com/#/blog/ysZepzLRLwBmohAQffHs</a></p><p>Angular 17 has landed, bringing with it a wave of exciting features: a new declarative control flow, simplified standalone APIs as the default, and the blazing-fast Vite + esbuild development server. This new era of Angular is all about improving developer experience and performance.</p><p>As we modernize our development workflow, it’s also the perfect time to re-evaluate our testing strategy. While the default Karma and Jasmine setup has served the community well, many developers prefer the speed, powerful features, and streamlined experience offered by <strong>Jest</strong>.</p><p>But here’s the catch: with the shift to Vite and esbuild in Angular 17+, the old ways of configuring Jest might not work as expected. Don’t worry, we’ve got you covered. This guide will walk you through setting up Jest in a modern Angular 17+ project, step-by-step.</p><h3>Why Bother with Jest?</h3><p>If you’re new to Jest, you might be wondering why you should switch. Here are a few compelling reasons:</p><p><strong>Incredible Speed:</strong> Jest runs tests in parallel, sandboxed processes, which can dramatically reduce your test suite’s execution time.<br><strong>Zero-Config Philosophy: </strong>While we need <strong>some</strong> config for Angular, Jest aims to work out of the box for most JavaScript projects.<br><strong>Snapshot Testing</strong>: Easily track changes to your UI components by saving snapshots of their rendered output.<br><strong>Rich Mocking Library</strong>: Jest’s built-in mocking capabilities are intuitive and powerful, making it easy to isolate your code for unit testing.<br><strong>All-in-One</strong>: Jest comes with everything you need: a test runner, assertion library (`expect`), and mocking support. No need to install multiple packages.</p><h3>The Challenge: Angular 17+ and the New Build System</h3><p>The biggest change affecting Jest configuration is Angular’s move away from Webpack (for development) to <strong>Vite and esbuild</strong>. This new tooling relies heavily on modern JavaScript features like <strong>ECMAScript Modules (ESM)</strong>.</p><p>Jest has traditionally had a rocky relationship with ESM. Many community presets and transformers were built for the CommonJS world of Webpack. Fortunately, the brilliant maintainers of `jest-preset-angular` have updated the library to seamlessly handle Angular’s new architecture.</p><p>The key is to use the right preset. Let’s get started!</p><h3>Step-by-Step Guide to Configuring Jest</h3><p>We’ll assume you have a fresh Angular 17+ project. If not, create one now:</p><pre>ng new my-awesome-app - standalone - ssr=false<br>cd my-awesome-app</pre><h3>Step 1: Install Jest Dependencies</h3><p>First, let’s install Jest and its essential sidekicks. The star of the show here is `jest-preset-angular`, which does the heavy lifting of teaching Jest how to understand Angular components, templates, and dependency injection.</p><pre>npm install - save-dev jest jest-preset-angular @types/jest</pre><p><strong>Step 2: Create the Jest Configuration File</strong></p><p>Next, create a Jest configuration file in the root of your project. We’ll name it `jest.config.ts`. This TypeScript file gives us type safety for our configuration.</p><p>Create `jest.config.ts` in your project’s root directory and add the following content:</p><pre>// jest.config.ts<br>import type { Config } from &#39;jest&#39;;<br>const config: Config = {<br> // The preset is the key to making Jest work with Angular.<br> preset: &#39;jest-preset-angular&#39;,<br>// A list of paths to modules that run some code to configure or set up the testing framework before each test.<br> setupFilesAfterEnv: [&#39;&lt;rootDir&gt;/setup-jest.ts&#39;],<br>// A recommended configuration for CI environments to prevent resource exhaustion.<br> // This tells Jest to use a maximum of 40% of the available CPU cores.<br> // Using a percentage is ideal for portability across different machines.<br> // For local development, you might want to comment this out to use Jest&#39;s faster default (all cores - 1).<br> maxWorkers: &#39;40%&#39;,<br>// A map from regular expressions to module names that stub out non-JavaScript files.<br> moduleNameMapper: {<br> &#39;\\.(css|less|scss|sass)$&#39;: &#39;identity-obj-proxy&#39;,<br> },<br>// The test environment that will be used for testing.<br> testEnvironment: &#39;jsdom&#39;,<br> <br> // By default, Jest will not transform any modules in `node_modules`.<br> // Here we&#39;re telling it to transform specific ES Modules that are commonly used in the Angular ecosystem.<br> transformIgnorePatterns: [<br> &#39;node_modules/(?!.*\\.mjs$|@angular|@ng-bootstrap|@ngrx|ngx-socket-io)&#39;<br> ],<br>};<br>export default config;</pre><p><strong>What’s happening here?</strong><br>- `preset: ‘jest-preset-angular’`: This is the magic wand. It configures Jest with all the necessary transformers and settings to compile and run tests for Angular code.</p><p>- `setupFilesAfterEnv`: This points to a file that will run before every test suite, which we’ll create next.</p><p>- `maxWorkers: ‘40%’`: This is a crucial setting for performance and stability, especially in CI/CD environments. It limits Jest to using a maximum of 40% of the available CPU cores to run tests in parallel. This prevents it from overloading the machine and ensures smooth operation, even on shared runners.</p><p>- `transformIgnorePatterns`: This is a key piece for the modern ecosystem. It tells Jest that it *should* transform certain packages inside `node_modules`, as many are now published as ESM.</p><p><strong>Step 3: Create the Jest Setup File</strong></p><p>As referenced in our config, we need a setup file. This file imports the global setup from `jest-preset-angular`, which handles tasks such as DOM serialization and setting up the testing module.</p><p>Create `setup-jest.ts` in your project’s root directory:</p><pre>// setup-jest.ts<br>import &#39;jest-preset-angular/setup-jest&#39;;<br>```<br><br></pre><p>That’s it! This one line is all you need.</p><p>Now, we need to tell TypeScript’s test configuration about our new setup. Open `tsconfig.spec.json` and modify it to look like this:</p><p><strong>Step 4: Update `tsconfig.spec.json`</strong></p><pre>{<br> &quot;extends&quot;: &quot;./tsconfig.json&quot;,<br> &quot;compilerOptions&quot;: {<br> &quot;outDir&quot;: &quot;./out-tsc/spec&quot;,<br> &quot;types&quot;: [<br> &quot;jest&quot; // ← Add &quot;jest&quot; here<br> ]<br> },<br> &quot;files&quot;: [<br> // Add these two files to ensure TypeScript knows about them<br> &quot;src/polyfills.ts&quot;,<br> &quot;setup-jest.ts&quot; // ← Add this line<br> ],<br> &quot;include&quot;: [<br> &quot;src/**/*.spec.ts&quot;,<br> &quot;src/**/*.d.ts&quot;<br> ]<br>}</pre><p><strong>Changes</strong>:<br>1. We added `”jest”` to the `types` array so TypeScript recognizes Jest’s global functions like `describe`, `it`, and `expect` without needing to import them in every file.<br>2. We added `setup-jest.ts` to the `files` array.</p><h3>Step 5: Add Test Scripts to `package.json`</h3><p>Finally, let’s make running our tests easy. Open `package.json` and update the `scripts` section. You can replace the existing `”test”` script.</p><pre>// package.json<br>&quot;scripts&quot;: {<br> &quot;ng&quot;: &quot;ng&quot;,<br> &quot;start&quot;: &quot;ng serve&quot;,<br> &quot;build&quot;: &quot;ng build&quot;,<br> &quot;watch&quot;: &quot;ng build - watch - configuration development&quot;,<br> &quot;test&quot;: &quot;jest&quot;,<br> &quot;test:watch&quot;: &quot;jest - watch&quot;,<br> &quot;test:ci&quot;: &quot;jest - runInBand - coverage&quot;<br>},</pre><blockquote>Now you can run your tests with these simple commands:<br>- `npm test`: Runs all tests once.<br>- `npm run test:watch`: Runs tests in watch mode, re-running on any file change.<br>- `npm run test:ci`: A good script for continuous integration, which runs tests sequentially and generates a coverage report.</blockquote><p><strong>Let’s Write a Test!</strong></p><p>Your existing tests should work with minimal changes. `jest-preset-angular` ensures that Angular’s `TestBed` works just as you expect. Here’s what the default `app.component.spec.ts` might look like:</p><pre>// src/app/app.component.spec.ts<br>import { TestBed } from &#39;@angular/core/testing&#39;;<br>import { AppComponent } from &#39;./app.component&#39;;<br>// Jest uses `describe`, `it` (or `test`), and `expect`<br>describe(&#39;AppComponent&#39;, () =&gt; {<br> beforeEach(async () =&gt; {<br> await TestBed.configureTestingModule({<br> imports: [AppComponent],<br> }).compileComponents();<br> });<br>it(&#39;should create the app&#39;, () =&gt; {<br> const fixture = TestBed.createComponent(AppComponent);<br> const app = fixture.componentInstance;<br> // `expect` is from Jest, but the syntax is familiar!<br> expect(app).toBeTruthy();<br> });<br>it(`should have the &#39;my-awesome-app&#39; title`, () =&gt; {<br> const fixture = TestBed.createComponent(AppComponent);<br> const app = fixture.componentInstance;<br> expect(app.title).toEqual(&#39;my-awesome-app&#39;);<br> });<br>it(&#39;should render title&#39;, () =&gt; {<br> const fixture = TestBed.createComponent(AppComponent);<br> fixture.detectChanges();<br> const compiled = fixture.nativeElement as HTMLElement;<br> expect(compiled.querySelector(&#39;h1&#39;)?.textContent).toContain(&#39;Hello, my-awesome-app&#39;);<br> });<br>});</pre><p>Run `npm test`, and you should see your tests passing with flying colors!</p><h3>Conclusion</h3><p>You’ve successfully replaced Karma and Jasmine with the modern, fast, and feature-rich Jest test runner in your Angular 17+ project.</p><p>By leveraging the power of `jest-preset-angular` and a modern configuration, you get the best of both worlds: Angular’s powerful component framework and Jest’s delightful testing experience. This setup not only speeds up your feedback loop but also unlocks powerful features like snapshot testing and sophisticated, portable performance management with options like `maxWorkers`.</p><p>Happy testing</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0350087eac22" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/supercharge-your-angular-17-testing-with-jest-a-modern-configuration-guide-0350087eac22">Supercharge Your Angular 17+ Testing with Jest: A Modern Configuration Guide</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular 20: Supercharge Your Data Fetching with the Signals Resource API]]></title>
            <link>https://javascript.plainenglish.io/angular-20-supercharge-your-data-fetching-with-the-signals-resource-api-69da1bcca9f6?source=rss-4b60047795fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/69da1bcca9f6</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[best-practices]]></category>
            <dc:creator><![CDATA[Orfeas Voutsaridis]]></dc:creator>
            <pubDate>Tue, 17 Jun 2025 05:35:47 GMT</pubDate>
            <atom:updated>2025-06-18T23:58:55.910Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K9uHfvo8SCOf7uO66ICBcA.jpeg" /></figure><p>Angular 20 is here, and it’s doubling down on the reactive paradigm with a more mature and powerful Signal API. For developers who have been navigating the complexities of state management and asynchronous data fetching, this release brings a game-changing (though still experimental) utility: the Signals resource API. This new addition aims to streamline how we handle data fetching from APIs, making our components cleaner, more declarative, and easier to reason about.</p><p>As a frontend engineer, you know the drill: fetch data, handle loading states, manage errors, and finally, display the result. This often leads to boilerplate code with multiple state variables (isLoading, error, data). The resource API, built on top of Angular&#39;s robust Signals, elegantly solves this by encapsulating this logic into a single, reactive primitive.</p><h3>What is the resource API?</h3><p>Think of the resource API as a specialized tool for fetching and managing data that comes from an asynchronous source, like an HTTP request. It&#39;s designed to work seamlessly with Signals, providing a reactive way to handle the entire lifecycle of a data-fetching operation.</p><p>A resource takes a function that returns a Promise or an Observable (the data source) and in return gives you a signal that exposes the status of that operation. This signal provides:</p><ul><li>The value: The data that was successfully fetched.</li><li>The loading state: A boolean indicating if the request is in progress.</li><li>The error state: Any error that might have occurred during the fetch.</li></ul><p>This means you can replace multiple useState or BehaviorSubject instances with a single resource signal, significantly simplifying your component&#39;s state management.</p><h3>A Practical Example: Fetching User Data</h3><p>Let’s dive into a common scenario: fetching user data from an API.</p><p>First, you’ll need a service to handle the HTTP request. This part remains standard Angular practice.</p><pre>// user.service.ts<br>import { Injectable, inject } from &#39;@angular/core&#39;;<br>import { HttpClient } from &#39;@angular/common/http&#39;;<br>import { Observable } from &#39;rxjs&#39;;export interface User {<br>  id: number;<br>  name: string;<br>  email: string;<br>}<br>@Injectable({ providedIn: &#39;root&#39; })<br>export class UserService {<br>  private http = inject(HttpClient);<br>  getUser(id: number): Observable&lt;User&gt; {<br>    return this.http.get&lt;User&gt;(`https://api.example.com/users/${id}`);<br>  }<br>}</pre><p>Now, let’s see how we can use the resource API within a component.</p><pre>// user-profile.component.ts<br>import { Component, Input, computed, signal } from &#39;@angular/core&#39;;<br>import { toSignal } from &#39;@angular/core/rxjs-interop&#39;;<br>import { resource } from &#39;@angular/core/signals&#39;; // Hypothetical import<br>import { UserService, User } from &#39;./user.service&#39;;<br><br>@Component({<br>  selector: &#39;app-user-profile&#39;,<br>  template: `<br>    &lt;div&gt;<br>      @switch (userResource().state) {<br>        @case (&#39;loading&#39;) {<br>          &lt;p&gt;Loading user...&lt;/p&gt;<br>        }<br>        @case (&#39;error&#39;) {<br>          &lt;p&gt;Error fetching user: {{ userResource().error.message }}&lt;/p&gt;<br>        }<br>        @case (&#39;loaded&#39;) {<br>          &lt;h2&gt;{{ userResource().value.name }}&lt;/h2&gt;<br>          &lt;p&gt;{{ userResource().value.email }}&lt;/p&gt;<br>        }<br>      }<br>    &lt;/div&gt;<br>  `,<br>})<br>export class UserProfileComponent {<br>  @Input({ required: true }) userId!: number;<br>  private userService = inject(UserService);<br>  // The &#39;resource&#39; API is still experimental and the exact implementation might differ.<br>  // This is a conceptual representation.<br>  userResource = resource(() =&gt; this.userService.getUser(this.userId));<br>}</pre><p>In this example, userResource is a signal that automatically tracks the state of the getUser Observable. The template can then use a @switch block to reactively display the correct UI for each state: loading, error, or loaded.</p><p>Notice the clean and declarative nature of this approach. We are no longer manually managing boolean flags for loading and error states.</p><h3>Common Use Cases</h3><p>The resource API is incredibly versatile. Here are a few use cases where it can significantly simplify your code:</p><ul><li>Displaying data from an API: This is the most direct use case, as shown in the example above. It’s perfect for dashboards, user profiles, and any component that relies on remote data.</li><li>Cascading Data Requests: Imagine you need to fetch a user’s posts after you’ve fetched their profile. You can chain resource calls, with the second resource depending on the result of the first.</li><li>Search Functionality: For a search input that triggers an API call, you can create a resource that takes the search term signal as a dependency. The resource will automatically re-fetch the data whenever the search term changes.</li><li>searchTerm = signal(&#39;&#39;); searchResults = resource(() =&gt; this.apiService.search(this.searchTerm()));</li><li>Lazy Loading Data: In combination with @defer, you can trigger a resource to fetch data only when a component becomes visible, optimizing your application&#39;s initial load time.</li></ul><h3>A Note on its Experimental Status</h3><p>It’s crucial to remember that as of Angular 20, the resource API is still experimental. This means its API surface could change in future releases, and it&#39;s not yet recommended for production use without careful consideration. The official documentation at angular.dev will be the definitive source for its stable release and usage guidelines.</p><p>The introduction of the resource signal is a clear indication of the Angular team&#39;s commitment to making reactive programming more intuitive and powerful. As you explore the new features of Angular 20, keep an eye on this exciting development. It has the potential to become a cornerstone of modern Angular development, simplifying asynchronous state management for a more enjoyable and productive coding experience.</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69da1bcca9f6" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/angular-20-supercharge-your-data-fetching-with-the-signals-resource-api-69da1bcca9f6">Angular 20: Supercharge Your Data Fetching with the Signals Resource API</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[20 Best Practices for Modern Angular (v17+)]]></title>
            <link>https://javascript.plainenglish.io/20-best-practices-for-modern-angular-v17-5258511a4bd0?source=rss-4b60047795fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/5258511a4bd0</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Orfeas Voutsaridis]]></dc:creator>
            <pubDate>Sun, 15 Jun 2025 08:01:08 GMT</pubDate>
            <atom:updated>2025-06-18T23:59:00.408Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.voutsaridiso.com/#/blog/v2DAuED1LgMElpmDqBVQ">https://www.voutsaridiso.com/#/blog/v2DAuED1LgMElpmDqBVQ</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Je0Qu3tuFiR7iI1vN82lJA.jpeg" /></figure><h3>1. Embrace Standalone Components</h3><p>Simplify your architecture by using standalone components, pipes, and directives. This is the default in modern Angular and reduces the boilerplate of NgModules.</p><pre>// user-profile.component.ts<br>import { Component } from &#39;@angular/core&#39;;<br>import { CommonModule } from &#39;@angular/common&#39;;<br><br>@Component({<br>  selector: &#39;app-user-profile&#39;,<br>  standalone: true, // Mark component as standalone<br>  imports: [CommonModule], // Import dependencies directly<br>  template: `&lt;p&gt;User Profile&lt;/p&gt;`<br>})<br>export class UserProfileComponent {}</pre><h3>2. Use the Built-in Control Flow (@if, @for)</h3><p>The new built-in control flow is more performant and has a cleaner, more intuitive syntax than the older *ngIf and *ngFor directives.</p><p>TypeScript</p><pre>// user-list.component.ts<br>@Component({<br>  selector: &#39;app-user-list&#39;,<br>  standalone: true,<br>  template: `<br>    @for (user of users; track user.id) {<br>      &lt;div&gt;{{ user.name }}&lt;/div&gt;<br>    } @empty {<br>      &lt;p&gt;No users found.&lt;/p&gt;<br>    }<br>  `<br>})<br>export class UserListComponent {<br>  users = [{id: 1, name: &#39;John Doe&#39;}];<br>}</pre><h3>3. Leverage Signals for State Management</h3><p>Use Angular Signals for fine-grained, efficient state management. They are the new core reactive primitive in Angular, simplifying state changes and improving performance.</p><p>TypeScript</p><pre>// counter.component.ts<br>import { Component, signal, computed } from &#39;@angular/core&#39;;<br>@Component({<br>  selector: &#39;app-counter&#39;,<br>  standalone: true,<br>  template: `<br>    &lt;button (click)=&quot;increment()&quot;&gt;Count: {{ count() }}&lt;/button&gt;<br>    &lt;p&gt;Double count is: {{ doubleCount() }}&lt;/p&gt;<br>  `<br>})<br>export class CounterComponent {<br>  // Create a writable signal<br>  count = signal(0);<br>  <br>  // Create a computed signal that depends on &#39;count&#39;<br>  doubleCount = computed(() =&gt; this.count() * 2);<br>increment() {<br>    // Update the signal&#39;s value<br>    this.count.update(value =&gt; value + 1);<br>  }<br>}</pre><h3>4. Use OnPush Change Detection</h3><p>Improve performance by reducing unnecessary change detection cycles. OnPush is a powerful strategy, especially in large applications.</p><p>TypeScript</p><pre>// user-card.component.ts<br>import { Component, ChangeDetectionStrategy, Input } from &#39;@angular/core&#39;;@Component({<br>  selector: &#39;app-user-card&#39;,<br>  standalone: true,<br>  template: `&lt;h2&gt;{{ user.name }}&lt;/h2&gt;`,<br>  // Use OnPush strategy to optimize change detection<br>  changeDetection: ChangeDetectionStrategy.OnPush<br>})<br>export class UserCardComponent {<br>  @Input() user: { name: string };<br>}</pre><h3>5. Use the async Pipe</h3><p>The async pipe automatically subscribes to an Observable or Promise and returns the latest value. It also unsubscribes automatically when the component is destroyed, preventing memory leaks.</p><p>TypeScript</p><pre>// user-data.component.ts<br>import { Component } from &#39;@angular/core&#39;;<br>import { CommonModule } from &#39;@angular/common&#39;;<br>import { Observable, of } from &#39;rxjs&#39;;<br><br>@Component({<br>  selector: &#39;app-user-data&#39;,<br>  standalone: true,<br>  imports: [CommonModule],<br>  template: `<br>    &lt;div&gt;{{ user$ | async }}&lt;/div&gt;<br>  `<br>})<br>export class UserDataComponent {<br>  user$: Observable&lt;string&gt; = of(&#39;Jane Doe&#39;);<br>}</pre><h3>6. Lazy Load with @defer</h3><p>Use the @defer block to declaratively lazy load components, directives, and pipes. This improves initial page load performance by deferring the loading of non-critical content.</p><p>TypeScript</p><pre>// dashboard.component.ts<br>import { HeavyChartComponent } from &#39;./heavy-chart.component&#39;;<br>@Component({<br>  selector: &#39;app-dashboard&#39;,<br>  standalone: true,<br>  imports: [HeavyChartComponent], // The component to be deferred<br>  template: `<br>    &lt;h1&gt;Dashboard&lt;/h1&gt;<br>    @defer (on viewport) {<br>      &lt;app-heavy-chart /&gt;<br>    } @placeholder {<br>      &lt;p&gt;Chart is loading...&lt;/p&gt;<br>    } @error {<br>      &lt;p&gt;Failed to load chart.&lt;/p&gt;<br>    }<br>  `<br>})<br>export class DashboardComponent {}</pre><h3>7. Use trackBy for Lists</h3><p>When rendering lists, trackBy (or the track parameter in @for) helps Angular identify which items have changed, preventing the entire list from being re-rendered in the DOM.</p><p>TypeScript</p><pre>// product-list.component.ts<br>@Component({<br>  selector: &#39;app-product-list&#39;,<br>  standalone: true,<br>  template: `<br>    @for(product of products; track product.id) {<br>      &lt;div&gt;{{ product.name }}&lt;/div&gt;<br>    }<br>  `<br>})<br>export class ProductListComponent {<br>  products = [{id: 1, name: &#39;Laptop&#39;}, {id: 2, name: &#39;Mouse&#39;}];<br>}</pre><h3>8. Use Strictly Typed Reactive Forms</h3><p>Take advantage of strongly typed forms (stable since v14) to improve type safety, autocompletion, and developer experience.</p><p>TypeScript</p><pre>// profile-form.component.ts<br>import { Component } from &#39;@angular/core&#39;;<br>import { FormControl, FormGroup, Validators } from &#39;@angular/forms&#39;;<br><br>@Component({ /* ... */ })<br>export class ProfileFormComponent {<br>  // Define types for the form controls for better safety<br>  profileForm = new FormGroup({<br>    name: new FormControl(&#39;&#39;, [Validators.required]),<br>    email: new FormControl(&#39;&#39;, [Validators.required, Validators.email])<br>  });<br>}</pre><h3>9. Use the inject() Function</h3><p>The inject() function allows for constructor-less dependency injection, offering more flexibility, especially within reusable functions and modern functional components like route guards.</p><p>TypeScript</p><pre>// logger.service.ts<br>import { Injectable, inject } from &#39;@angular/core&#39;;<br>import { HttpClient } from &#39;@angular/common/http&#39;;<br><br>@Injectable({ providedIn: &#39;root&#39; })<br>export class LoggerService {<br>  // Use inject() for a more flexible DI pattern<br>  private http = inject(HttpClient);<br>  log(message: string) {<br>    console.log(message);<br>    // this.http.post(...);<br>  }<br>}</pre><h3>10. Use Functional Route Guards</h3><p>With the evolution of Angular, functional guards have become the standard. They are simpler, tree-shakable, and don’t require a class.</p><p>TypeScript</p><pre>// auth.guard.ts<br>import { inject } from &#39;@angular/core&#39;;<br>import { CanActivateFn, Router } from &#39;@angular/router&#39;;<br>import { AuthService } from &#39;./auth.service&#39;;// A functional route guard is a simple, exportable function<br>export const authGuard: CanActivateFn = (route, state) =&gt; {<br>  const authService = inject(AuthService);<br>  const router = inject(Router);<br>  if (authService.isLoggedIn()) {<br>    return true;<br>  }<br>  <br>  // Redirect to login page if not authenticated<br>  return router.parseUrl(&#39;/login&#39;);<br>};</pre><h3>11. Use Functional HTTP Interceptors</h3><p>Similar to guards, HTTP interceptors can now be written as simple functions, making them more lightweight and easier to manage.</p><p>TypeScript</p><pre>// auth.interceptor.ts<br>import { HttpInterceptorFn } from &#39;@angular/common/http&#39;;<br>export const authInterceptor: HttpInterceptorFn = (req, next) =&gt; {<br>  const authToken = &#39;YOUR_AUTH_TOKEN&#39;;<br>  <br>  // Clone the request and add the authorization header<br>  const authReq = req.clone({<br>    setHeaders: { Authorization: `Bearer ${authToken}` }<br>  });<br>  <br>  return next(authReq);<br>};</pre><h3>12. Use ng-content for Content Projection</h3><p>Create flexible, reusable wrapper components by projecting content into them using ng-content.</p><p>TypeScript</p><pre>// card.component.ts<br>@Component({<br>  selector: &#39;app-card&#39;,<br>  standalone: true,<br>  template: `<br>    &lt;div class=&quot;card&quot;&gt;<br>      &lt;div class=&quot;card-header&quot;&gt;<br>        &lt;ng-content select=&quot;[header]&quot;&gt;&lt;/ng-content&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;card-body&quot;&gt;<br>        &lt;ng-content&gt;&lt;/ng-content&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  `<br>})<br>export class CardComponent {}</pre><h3>13. Leverage Environment Variables</h3><p>Keep your application configuration clean and separate for different environments (development, production) using the built-in environment files.</p><p>TypeScript</p><pre>// environments/environment.ts<br>export const environment = {<br>  production: false,<br>  apiUrl: &#39;http://localhost:3000/api&#39;<br>};<br><br>// environments/environment.prod.ts<br>export const environment = {<br>  production: true,<br>  apiUrl: &#39;[https://api.myapp.com/api](https://api.myapp.com/api)&#39;<br>};</pre><h3>14. Avoid any Type</h3><p>Leverage TypeScript’s strict typing to catch errors early, improve code readability, and make your code more self-documenting.</p><p>TypeScript</p><pre>// BAD: Unclear and error-prone<br>function processItem(item: any) {<br>  console.log(item.name); // No type checking<br>}<br><br>// GOOD: Type-safe and explicit<br>interface User { id: number; name: string; }<br>function processUser(user: User) {<br>  console.log(user.name);<br>}</pre><h3>15. Use HostBinding and HostListener</h3><p>Use these decorators to manage properties and events on the host element of a component or directive without directly accessing the DOM.</p><p>TypeScript</p><pre>// highlight.directive.ts<br>import { Directive, HostBinding, HostListener, ElementRef } from &#39;@angular/core&#39;;<br>@Directive({<br>  selector: &#39;[appHighlight]&#39;,<br>  standalone: true<br>})<br>export class HighlightDirective {<br>  // Bind the host element&#39;s backgroundColor property<br>  @HostBinding(&#39;style.backgroundColor&#39;) backgroundColor: string = &#39;&#39;;<br>  // Listen for mouseenter event on the host<br>  @HostListener(&#39;mouseenter&#39;) onMouseEnter() {<br>    this.backgroundColor = &#39;yellow&#39;;<br>  }<br>  // Listen for mouseleave event on the host<br>  @HostListener(&#39;mouseleave&#39;) onMouseLeave() {<br>    this.backgroundColor = &#39;&#39;;<br>  }<br>}</pre><h3>16. Use Aliases for Inputs/Outputs Sparingly</h3><p>Stick to the original property name for @Input() and @Output() unless an alias is truly necessary. This keeps the public API of your component consistent with its internal properties.</p><p>TypeScript</p><pre>// BAD: Inconsistent and can cause confusion<br>@Input(&#39;userRecord&#39;) user: User;<br>@Output(&#39;userChange&#39;) userEmitter = new EventEmitter&lt;User&gt;();<br>// GOOD: Clean, simple, and predictable<br>@Input() user: User;<br>@Output() userChange = new EventEmitter&lt;User&gt;();</pre><h3>17. Use Dependency Injection (DI) Tokens</h3><p>Use an InjectionToken to provide non-class dependencies like configuration objects or values.</p><p>TypeScript</p><pre>// app.config.ts<br>import { InjectionToken } from &#39;@angular/core&#39;;<br>export interface AppConfig { apiUrl: string; apiKey: string; }<br>// Create a token to be used for dependency injection<br>export const APP_CONFIG = new InjectionToken&lt;AppConfig&gt;(&#39;app.config&#39;);</pre><h3>18. Keep Components Lean</h3><p>Components should primarily handle view logic. Delegate complex business logic, API calls, and data transformations to services to keep your components clean and focused.</p><p>TypeScript</p><pre>// BAD: Component is doing too much work (fat component)<br>@Component({ /* ... */ })<br>export class UserProfileComponent implements OnInit {<br>  constructor(private http: HttpClient) {}<br>  ngOnInit() {<br>    this.http.get(&#39;/api/user&#39;).subscribe(/* ... */);<br>  }<br>}<br>// GOOD: Component delegates complex logic to a dedicated service<br>@Component({ /* ... */ })<br>export class UserProfileComponent implements OnInit {<br>  constructor(private userService: UserService) {}<br>  ngOnInit() {<br>    this.userService.getUser().subscribe(/* ... */);<br>  }<br>}</pre><h3>19. Analyze Your Bundle Size</h3><p>Regularly check what’s contributing to your application’s final bundle size to identify optimization opportunities. A great tool for this is source-map-explorer.</p><p>Bash</p><pre># First, build your app with source maps<br>ng build --source-map<br># Then, run the explorer on the generated bundles<br>npx source-map-explorer dist/your-app-name/browser/*.js</pre><h3>20. Write Meaningful Tests</h3><p>Ensure your application’s reliability and make refactoring safer by writing unit tests for your logic (services, functions) and component tests for your UI interactions.</p><p>TypeScript</p><pre>// user.service.spec.ts<br>describe(&#39;UserService&#39;, () =&gt; {<br>  it(&#39;should fetch user data correctly&#39;, () =&gt; {<br>    // Test your service logic here<br>    // Mock dependencies like HttpClient and assert outcomes<br>  });<br>});</pre><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://x.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/@InPlainEnglish"><strong>YouTube</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a> | <a href="https://open.spotify.com/show/7qxylRWKhvZwMz2WuEoua0"><strong>Podcast</strong></a> | <a href="https://twitch.tv/inplainenglish"><strong>Twitch</strong></a></li><li><a href="https://differ.blog/"><strong>Start your own free AI-powered blog on Differ</strong></a> 🚀</li><li><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Join our content creators community on Discord</strong></a> 🧑🏻‍💻</li><li>For more content, visit <a href="https://plainenglish.io/"><strong>plainenglish.io</strong></a> + <a href="https://stackademic.com/"><strong>stackademic.com</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5258511a4bd0" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/20-best-practices-for-modern-angular-v17-5258511a4bd0">20 Best Practices for Modern Angular (v17+)</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Face Detection with React, TensorFlow.js, and Webcam]]></title>
            <link>https://medium.com/@orfeas_erevos/face-detection-with-react-tensorflow-js-and-webcam-372d5675c42a?source=rss-4b60047795fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/372d5675c42a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tensorflowjs]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Orfeas Voutsaridis]]></dc:creator>
            <pubDate>Sat, 17 May 2025 07:49:53 GMT</pubDate>
            <atom:updated>2025-05-17T07:49:53.633Z</atom:updated>
            <content:encoded><![CDATA[<p>This project demonstrates how to perform real-time object detection — including basic face/person detection — directly in the browser using TensorFlow.js and the CocoSSD model. By accessing the user’s webcam and running inference locally, the application respects privacy and requires no backend server.</p><p><a href="https://www.voutsaridiso.com/#/blog/GWw8M6U51nblyn9ShmZ8">Official link</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kgZLND3AElPFytFNO7GWUQ.jpeg" /></figure><h3>🧠 Real-Time Face Detection in the Browser with TensorFlow.js and CocoSSD</h3><p>.</p><h3>🤖 What Is CocoSSD?</h3><p><a href="https://github.com/tensorflow/tfjs-models/tree/master/coco-ssd">CocoSSD</a> is a pre-trained object detection model trained on the <a href="https://cocodataset.org/">COCO dataset</a>, which includes 90 classes like:</p><ul><li>Person</li><li>Bicycle</li><li>Car</li><li>Dog</li><li>Chair</li></ul><p>While it’s not a dedicated face detection model, it can reliably identify people in camera frames, making it suitable for simple face detection use cases.</p><h3>🧠 Why TensorFlow.js?</h3><p>TensorFlow.js enables running ML models in the browser using JavaScript. It offers:</p><ul><li>No backend required</li><li>GPU acceleration (WebGL)</li><li>Real-time predictions</li><li>Privacy — all processing is local to the user’s device</li></ul><h3>📸 Webcam Integration</h3><p>Using the navigator.mediaDevices.getUserMedia() API, we stream video from the user’s webcam into a &lt;video&gt; element.</p><pre>navigator.mediaDevices.getUserMedia({ video: true })<br>  .then(stream =&gt; {<br>    video.srcObject = stream;<br>  });</pre><p>The video is then used as input to the TensorFlow model for continuous inference.</p><h3>🧪 Real-Time Detection Workflow</h3><ol><li>Load the CocoSSD model:</li></ol><pre>const model = await cocoSsd.load();</pre><p>Run detection on each frame:</p><pre>model.detect(video).then(predictions =&gt; {<br>  // Draw bounding boxes<br>});</pre><p>Draw the results on a &lt;canvas&gt; overlay.</p><h3>🛠 Technologies Used</h3><ul><li>TensorFlow.js (via CDN)</li><li>CocoSSD object detection model</li><li>JavaScript / HTML5</li><li>&lt;video&gt; and &lt;canvas&gt; APIs</li><li>nodejs</li><li>ReactJS</li></ul><h3>🚀 How to Run</h3><ol><li>Clone the repo:</li></ol><pre>git clone https://github.com/erevos-13/coco-ssd-img<br>cd coco-ssd-img<br>npm i<br></pre><p>Serve the app locally:</p><pre>#nodejs<br> npm run dev</pre><p>Open the browser and allow webcam access.</p><h3>💡 Limitations</h3><p>The Coco-SSD model in TensorFlow (often used via <a href="https://github.com/tensorflow/tfjs-models/tree/master/coco-ssd">TensorFlow.js</a>) is a lightweight object detection model trained on the COCO dataset. While it’s convenient and works well for many use cases, it comes with several limitations:</p><h3>🔹 1. Limited Object Classes</h3><ul><li>Only 90 object categories: It’s trained on the COCO dataset which includes common objects like <em>person</em>, <em>car</em>, <em>dog</em>, <em>bicycle</em>, etc.</li><li>Cannot detect custom objects unless you retrain or fine-tune another model on a different dataset.</li></ul><h3>🔹 2. Lower Accuracy Compared to Heavier Models</h3><ul><li>Coco-SSD uses a MobileNet backbone, which trades off detection accuracy for speed.</li><li>It’s less accurate than heavier models like Faster R-CNN, YOLOv4, or EfficientDet — especially in complex or cluttered scenes.</li></ul><h3>🔹 3. No Fine-Grained Detection</h3><ul><li>The model struggles with small objects, overlapping instances, and fine-grained classification (e.g., different dog breeds).</li><li>Bounding boxes can be less precise than anchor-based or two-stage detectors.</li></ul><h3>🔹 4. Single Scale Detection</h3><ul><li>It lacks multi-scale feature fusion (unlike SSD with FPN or YOLOv5), which affects performance on varying object sizes.</li></ul><h3>🔹 5. Limited Edge Performance</h3><ul><li>While it’s relatively light, real-time inference can still be too slow on very low-end hardware (e.g., old smartphones or Raspberry Pi without acceleration).</li></ul><h3>🔹 6. No Instance Segmentation</h3><ul><li>It provides bounding boxes only, not pixel-level masks like models from the Mask R-CNN family.</li></ul><h3>🔹 7. No Training Support in TF.js</h3><ul><li>TensorFlow.js version supports inference only — you can’t train or fine-tune the model in-browser.</li></ul><h3>When to Use Coco-SSD</h3><p>Use Coco-SSD when:</p><ul><li>You need fast and reasonably accurate object detection.</li><li>You’re building a web-based or lightweight mobile app.</li><li>Your objects fall within the 90 COCO categories.</li></ul><p>Avoid it when:</p><ul><li>You need high accuracy, custom objects, or segmentation.</li></ul><p>Would you like alternatives or guidance on how to retrain a custom object detector using TensorFlow?</p><p>For better face-focused features, consider using:</p><ul><li><a href="https://github.com/tensorflow/tfjs-models/tree/master/blazeface">BlazeFace</a></li><li><a href="https://github.com/justadudewhohacks/face-api.js">Face-api.js</a></li></ul><h3>📝 Conclusion</h3><p>This project is a simple but powerful demonstration of what’s possible with machine learning in the browser. Using just JavaScript and TensorFlow.js, we built a real-time face/person detection tool that runs on any modern device — no installation, no servers, no compromise on privacy.</p><h3>📎 Useful Links</h3><ul><li><a href="https://www.tensorflow.org/js">TensorFlow.js</a></li><li><a href="https://github.com/tensorflow/tfjs-models/tree/master/coco-ssd">CocoSSD on GitHub</a></li><li><a href="https://face-detection.voutsaridiso.com/">Live Demo</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=372d5675c42a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Full Stack Illusion: Jack of All, Master of None]]></title>
            <link>https://medium.com/@orfeas_erevos/the-full-stack-illusion-jack-of-all-master-of-none-e1699e59faf5?source=rss-4b60047795fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1699e59faf5</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Orfeas Voutsaridis]]></dc:creator>
            <pubDate>Sat, 17 May 2025 07:43:20 GMT</pubDate>
            <atom:updated>2025-05-17T07:43:20.587Z</atom:updated>
            <content:encoded><![CDATA[<p>Link to the official doc:</p><p><a href="https://www.voutsaridiso.com/#/blog/rR875dd0hObm2Ui561b9">Orfeas Voutsaridis</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XpZwbk7sheC7jc6z8-zTFg.png" /></figure><p>Full stack developers are everywhere — from startup teams to job boards promising that magical “one dev to rule them all.” But let’s pause for a second.</p><p>Is the <em>full stack developer</em> really the expert they’re made out to be?</p><p>In most cases… not quite.</p><h3>What is a Full Stack Developer?</h3><p>At its core, a full stack developer is someone who works on both:</p><ul><li>Frontend: The browser side — UI/UX, user interactions, visual design.</li><li>Backend: The server side — databases, APIs, and server logic.</li></ul><p>It sounds great on paper. One person who can do it all. But in practice, that breadth often comes at the cost of depth.</p><h3>The Myth of Full Stack Mastery</h3><p>Many companies dream of hiring a single developer to build entire platforms from scratch. It saves money. It speeds things up — right?</p><p>Well, not necessarily.</p><p>The fallacy here is that one person can’t truly master both the frontend and backend, especially given how fast each is evolving.</p><p>Think of it like this:</p><ul><li>A general physician can treat common ailments, but for brain surgery, you call a neurosurgeon.</li><li>A handyman can install a shelf, but for rewiring your house, you want a certified electrician.</li></ul><p>The same logic applies to software engineering.</p><h3>Surface-Level Skills vs Deep Expertise</h3><p>Most full stack developers know just enough to get things working on both ends. For example:</p><h3>What they usually know:</h3><ul><li>Frontend: HTML, CSS, JavaScript, maybe React or Vue</li><li>Backend: Simple APIs, auth flows, CRUD database usage</li></ul><h3>What they usually lack:</h3><ul><li>Frontend: UX design, accessibility, performance optimization, design systems</li><li>Backend: Distributed systems, secure architecture, scalability under load</li></ul><p>In many cases, this creates a product that’s <em>functional</em>, but not <em>robust</em>.</p><h3>The Risks of Hiring “Full Stack” for Everything</h3><p>While full stack developers can be incredibly useful, relying solely on them for complex products can lead to trouble:</p><ul><li>Technical debt from poorly architected systems</li><li>Bottlenecks due to shallow knowledge in key areas</li><li>Burnout from unrealistic expectations placed on a single person</li></ul><p>You don’t want your product held together by duct tape and overworked generalists.</p><h3>When Full Stack Developers Actually Make Sense</h3><p>That’s not to say full stack devs are bad hires. In fact, they can be perfect for the right context:</p><ul><li>Startups and MVPs: When you’re moving fast and need working prototypes</li><li>Growth-oriented roles: Where devs start broad and specialize over time</li><li>Mentored teams: Where architecture and design decisions are guided by specialists</li></ul><p>The key is knowing their limits and setting realistic expectations.</p><h3>Why Specialization Still Matters</h3><p>In complex systems, deep expertise pays off:</p><ul><li>Frontend experts know how to craft accessible, fast, and user-friendly interfaces.</li><li>Backend specialists can build scalable, secure, and efficient systems.</li></ul><p>Together, they create a solid product. Full stack developers are great collaborators, but depth is what takes software from <em>meh</em> to <em>masterful</em>.</p><p>Encourage full stack devs to eventually pick a lane — the one they’re most passionate about — and grow deep roots.</p><h3>Final Thoughts</h3><p>The “full stack developer” isn’t a myth — but the idea that they’re experts in both frontend and backend? That’s often just marketing fluff.</p><p>They’re flexible. Resourceful. Valuable. But they’re not a silver bullet.</p><p>So next time you’re hiring, building a team, or thinking about your career path, remember:</p><p>Full stack is a starting point — not the destination.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1699e59faf5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplifying State Management in React with MobX]]></title>
            <link>https://medium.com/@orfeas_erevos/title-simplifying-state-management-in-react-with-mobx-c3d59cc86d5e?source=rss-4b60047795fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3d59cc86d5e</guid>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Orfeas Voutsaridis]]></dc:creator>
            <pubDate>Fri, 12 May 2023 17:46:58 GMT</pubDate>
            <atom:updated>2023-05-12T18:33:56.434Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*57T192XD-VgI1yhX" /><figcaption>Photo by <a href="https://unsplash.com/@stoman?utm_source=medium&amp;utm_medium=referral">Nangialai Stoman</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Simplifying State Management in React with MobX</p><p>Introduction:<br>In the world of modern web development, ReactJS has emerged as one of the most popular JavaScript libraries for building user interfaces. Its component-based architecture and virtual DOM rendering make it efficient and powerful. However, managing application state can become challenging as projects grow in complexity. That’s where MobX comes in. In this article, we’ll explore the benefits of using MobX as a state management solution in React and learn how to integrate it into your projects.</p><p>Understanding MobX:<br>MobX is a simple and scalable state management library that helps developers maintain application state in a reactive and efficient manner. It follows the principles of reactive programming and ensures that the UI automatically updates whenever the underlying state changes. MobX accomplishes this by using observables, computed values, and actions.</p><p>Setting Up a React Project with MobX:<br>To get started with MobX in a React project, you’ll need to set up the necessary dependencies. Create a new React project using your preferred tool, such as Create React App, and install MobX and MobX React.</p><pre>npx create-react-app my-app<br>cd my-app<br>npm install mobx mobx-react</pre><p>Defining Observables and Actions:<br>Observables are the building blocks of MobX. They are objects that can be observed for changes, and any changes trigger the appropriate reactions. In a React component, you can define observables using MobX’s `<em>observable</em>` decorator or the `makeObservable` function.</p><p>Actions, on the other hand, are methods that modify the state. They are responsible for updating the observables and ensuring the changes propagate throughout the application. Actions can be defined using the `<em>action</em>` decorator or by wrapping them with the `<em>runInAction</em>` function.</p><p>Creating Computed Values:<br>Computed values in MobX are derived from the observables and represent the derived state. They are lazily evaluated and automatically updated whenever the underlying observables change. To create a computed value, you can use the `computed` decorator or the `makeObservable` function.</p><p>Integrating MobX with React Components:<br>To make MobX work seamlessly with React components, you need to wrap your component hierarchy with the `observer` higher-order component provided by `mobx-react`. The `observer` component ensures that the components re-render whenever the observables depend on change.</p><pre>import { observer } from &#39;mobx-react&#39;;<br>const MyComponent = observer(() =&gt; {<br> // Component code here<br>});</pre><p>Using MobX in React Components:<br>Within your React components, you can access the observables and actions by importing them from your MobX store or injecting them using React’s context API. By using the observables, you can access and display the state in your component. When actions are invoked, MobX automatically tracks dependencies and updates the relevant observables and computed values.</p><p>Benefits of MobX:<br>1. <strong>Simplicity</strong>: MobX provides a simple and intuitive API, making it easy to understand and adopt in your projects.<br>2. <strong>Reactiveness</strong>: With MobX, your UI automatically updates whenever the state changes, reducing the need for manual updates and event handling.<br>3. <strong>Efficiency</strong>: MobX uses fine-grained observables and only updates the components that depend on the changed state, resulting in efficient rendering.<br>4. <strong>Scalability</strong>: As your application grows, MobX scales effortlessly by tracking dependencies and updating only what’s necessary.<br>5. <strong>Developer Experience</strong>: MobX’s declarative approach simplifies state management, reducing boilerplate code and enabling faster development.</p><p>Conclusion:<br>Managing the state in React applications can be challenging, especially as the complexity grows. MobX offers a powerful and intuitive solution to this problem by providing a reactive and efficient state management mechanism. By</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3d59cc86d5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>