Skip to main content

Frontend Architecture

Explore practical guides and implementation patterns for this topic.

Posts

Lightning Web Components

🗣️ Component Communication in LWC: @api, Events & LMS Explained

💬 In plain words: In Lightning Web Components (LWC), there are three distances your data can travel, and three exact tools to use. To talk down (Parent → Child), use @api properties. To talk up (Child → Parent), fire a CustomEvent . To talk to strangers (components anywhere else on the page), use the Lightning Message Service (LMS), which acts like a page-wide radio channel. 📌 Example: E-Commerce Store A user clicks "Add to Cart" on a product tile (Child). The tile fires a CustomEvent('addtocart') upwards. The main product grid (Parent) catches that event, updates its internal state, and passes the new cart count down to the cart badge (another Child) via an @api property. Meanwhile, a mini-cart widget living totally separately in the page header listens to a Lightning Message Service (LMS) channel to know the cart was updated.
Read article
Topic CSS Scoping Custom Elements Frontend Architecture Javascript Shadow DOM Web Components Web Development
CSS Scoping Custom Elements Frontend Architecture Javascript Shadow DOM Web Components Web Development

Mastering Shadow DOM v1: Encapsulation, Styling & Web Standards

In plain words: Shadow DOM v1 is a core web standard that allows developers to attach a hidden, encapsulated DOM tree to a host element. By isolating the component's internal markup, styles, and scripts from the rest of the web page, Shadow DOM prevents global CSS leakage and script conflicts, making it the foundational engine behind modern frameworks like Salesforce LWC. In modern web development, building robust and maintainable web applications requires strict component encapsulation. Without isolation, global CSS rules often collide, causing unexpected layout shifts across components. Shadow DOM v1 solves this problem by providing native browser-level encapsulation for reusable custom elements.
Read article
Topic LWC
Lightning Web Components

How to Dynamically Style Salesforce LWC Datatables with Custom CSS

In plain words: Dynamic styling in an LWC datatable means altering cell colors, badges, and fonts based on each row's underlying record data (such as painting an Error row red or a Success row green) at runtime. Standard Salesforce Lightning Web Components isolate CSS using the Shadow DOM. To style tabular cells conditionally based on record values—like rendering status indicators, alerts, or audit badges—developers can map calculated CSS classes dynamically through JavaScript getters or custom data structures.
Read article
Topic LWC
Lightning Web Components

How to Apply Dynamic Styling in Salesforce LWC (Classes, Getters & CSS Variables)

In plain words: Dynamic styling in Lightning Web Components (LWC) refers to modifying the colors, sizes, or layout of UI elements at runtime based on user actions, record data, or business logic. In Salesforce LWC, this is achieved by binding reactive JavaScript getters to the HTML class attribute or dynamically setting CSS custom properties (variables). Building responsive, user-friendly Lightning interfaces often requires visual cues like alert states, interactive toggles, or dynamic status badges. In this tutorial, you will learn standard, platform-compliant patterns for handling dynamic styling in LWC without violating Shadow DOM encapsulation.
Read article
Topic LWC
Lightning Web Components

How to Navigate Between Lightning Web Components in Salesforce Using NavigationMixin

In plain words: Navigating from one LWC to another in Salesforce means programmatically redirecting the user to a target component or custom Lightning tab using the standard NavigationMixin service from the lightning/navigation module. In modern Salesforce applications, directing users between screens with custom state and parameters is essential. By applying the NavigationMixin class decorator to your Lightning Web Component, you can generate dynamic page references and trigger smooth page transitions directly inside Lightning Experience and the Salesforce Mobile App.
Read article
Topic Async Await Fetch API Frontend Architecture HTTP Requests Javascript REST API Web Development
Async Await Fetch API Frontend Architecture HTTP Requests Javascript REST API Web Development

How to Make HTTP Requests in JavaScript: Fetch API, Async/Await & Best Practices

In plain words: An HTTP request in JavaScript is a network message sent from a browser or application to a web server to retrieve data (GET), submit new records (POST), or modify resources (PUT/DELETE) asynchronously without reloading the entire webpage. Connecting to web services and third-party REST APIs is an essential building block of modern web development. Whether you are consuming public datasets, sending form inputs, or building interactive web applications, JavaScript provides built-in tools like the Promise-based Fetch API and async/await syntax to manage network requests cleanly.
Read article