<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Asaf Eliasim</title>
    <description>The latest articles on DEV Community by Asaf Eliasim (@asaf_eliasim).</description>
    <link>https://dev.to/asaf_eliasim</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1224872%2Fd12bfd3a-b141-4687-9cd7-e091ca76be5f.png</url>
      <title>DEV Community: Asaf Eliasim</title>
      <link>https://dev.to/asaf_eliasim</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/asaf_eliasim"/>
    <language>en</language>
    <item>
      <title>Unsubscribe Observable! why is it so important?</title>
      <dc:creator>Asaf Eliasim</dc:creator>
      <pubDate>Mon, 23 Dec 2024 13:02:02 +0000</pubDate>
      <link>https://dev.to/asaf_eliasim/unsubscribe-observable-why-is-it-so-important-4p96</link>
      <guid>https://dev.to/asaf_eliasim/unsubscribe-observable-why-is-it-so-important-4p96</guid>
      <description>&lt;p&gt;In Angular, Observables are commonly used for asynchronous operations, like HTTP requests, user input events, or WebSocket messages. While Observables are powerful and efficient, one common pitfall developers can encounter is not unsubscribing from them when they are no longer needed. This can lead to &lt;strong&gt;memory leaks&lt;/strong&gt; — where the application continues to hold onto resources (memory) that should have been released.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Let's explain the issue with a real-life metaphor&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;

&lt;h1&gt;
  
  
  The Water Tap and the Bathtub
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3jpu09axjhimyauzwnel.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3jpu09axjhimyauzwnel.png" alt="water-tap-image" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
Imagine your application is like a bathtub, and Observables are like water taps filling the bathtub. When you create an Observable, it’s like turning on the tap. The data from the Observable keeps flowing into your app, just like water fills the bathtub. If you don’t close the tap (unsubscribe), the water keeps flowing endlessly, and the bathtub fills up indefinitely. Over time, this will cause issues, like an overflowing bathtub, just like a memory leak happens in your application when you don't unsubscribe from Observables.&lt;br&gt;
If you keep the tap running (don’t unsubscribe), your resources (memory) will eventually run out. The water (data) might even spill over and cause problems in other parts of the house (application). It’s a slow and often hidden process, but if unchecked, it will degrade your app's performance over time.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Causes Memory Leaks
&lt;/h2&gt;

&lt;p&gt;When you subscribe to an Observable and don’t unsubscribe, your application listens to the stream even after the component or service that initiated the Observable is no longer in use. This means that Angular will still hold onto the subscription object in memory, keeping it alive. If this happens multiple times, it can result in accumulated memory usage — which is what we call a memory leak.&lt;br&gt;
For instance, when a component is destroyed, if you don't unsubscribe, the Observable may continue emitting values to a destroyed component that no longer exists in the DOM. This can accumulate over time and cause the browser to consume more and more memory, slowing down or even crashing the application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Different ways to unsubscribe observables and prevent a memory leak issue ❕❕
&lt;/h2&gt;

&lt;p&gt;✅ &lt;strong&gt;Unsubscribe in ngOnDestroy&lt;/strong&gt;&lt;br&gt;
To ensure the observables are cleaned when the component is off, unsubscribe all observables inside the life hook.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwh321ew9oae38trm04is.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwh321ew9oae38trm04is.png" alt="unsubscribe" width="800" height="206"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Using 'rxjs' operator 'takeUntil'&lt;/strong&gt;&lt;br&gt;
It is a wonderful way to automatically clean subscriptions, especially when there is more than one observable. &lt;br&gt;
The operator automatically unsubscribes from observables when a specified condition is met.&lt;br&gt;
&lt;strong&gt;Take&lt;/strong&gt; the emitted values &lt;strong&gt;until&lt;/strong&gt; you met the condition.&lt;br&gt;
Usually, we will use a _destory$ Subject and emit a null value inside the life hook on destroy as our action to kill all subscribers. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7zkhjjw82xtm3ep4jjmh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7zkhjjw82xtm3ep4jjmh.png" alt="take-until" width="648" height="351"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Async pipe&lt;/strong&gt;&lt;br&gt;
The pipe subscribes to an Observable and returns the latest value it has emitted. When a new value is emitted, it marks the component to be checked for changes. When the component gets destroyed, the async pipe unsubscribes automatically. It reduces manual subscription management in the model.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp9tmliscm4ik9vsigtth.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp9tmliscm4ik9vsigtth.png" alt="Aync pipe" width="400" height="124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;DestroyRef&lt;/strong&gt;&lt;br&gt;
Those developing using Angular &amp;gt;= 16 can use this awesome provider (which provides you) to run a callback (unsubscribe) when the component is destroyed. 🤩&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqxgh1dgpa693zh6q9xua.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqxgh1dgpa693zh6q9xua.png" alt="DestroyRef" width="733" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;To summarize&lt;/strong&gt; 🤯&lt;br&gt;
Angular's developers or any other developers that are using the wonderful observables of '&lt;strong&gt;RXJS&lt;/strong&gt;' keep your subscriptions alive as you never keep your water tap, and every time you fill a bathtub, think about your last feature if you used observables and ensure to unsubscribe them. &lt;/p&gt;

</description>
      <category>angular</category>
      <category>rxjs</category>
      <category>frontend</category>
    </item>
    <item>
      <title>DOM - Elevator Pitch</title>
      <dc:creator>Asaf Eliasim</dc:creator>
      <pubDate>Fri, 22 Mar 2024 10:46:48 +0000</pubDate>
      <link>https://dev.to/asaf_eliasim/dom-elevator-pitch-cgd</link>
      <guid>https://dev.to/asaf_eliasim/dom-elevator-pitch-cgd</guid>
      <description>&lt;p&gt;&lt;strong&gt;Who doesn't know about puppets on a string? Pinkoyo-style&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;DOM stands for Document Object Model. It's the puppeteer for HTML pages.&lt;br&gt;
With the DOM, you can change the HTML page and adjust the elements. It's operated and maintained by JS, of course.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is a submission for DEV Challenge v24.03.20, One Byte Explainer: Browser API or Feature.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explainer
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Additional Context
&lt;/h2&gt;

</description>
      <category>frontendchallenge</category>
      <category>devchallenge</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Component store – perfect for managing local state</title>
      <dc:creator>Asaf Eliasim</dc:creator>
      <pubDate>Fri, 01 Mar 2024 15:03:46 +0000</pubDate>
      <link>https://dev.to/asaf_eliasim/component-store-perfect-for-managing-local-state-ke5</link>
      <guid>https://dev.to/asaf_eliasim/component-store-perfect-for-managing-local-state-ke5</guid>
      <description>&lt;p&gt;For those unfamiliar with @ngrx/component-store, this article serves as an imperative read, urging immediate hands-on practice. Additionally, I hope to uncover new insights and refine existing knowledge for those already familiar with its prowess.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Make yourself a cup of coffee and settle in for a few minutes to read.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;💥 &lt;strong&gt;What is it component store?&lt;/strong&gt;&lt;br&gt;
The Component Store serves as a tailored state management solution, explicitly designed to handle the state of individual components rather than the global application state, as seen in @ngrx/store. Like other state management solutions, the Component Store enables reading, writing, and handling side effects. Notably, it operates as a push-based service, rendering components reactive. Subscribing to the store allows the view to effortlessly capture immediate changes, amplifying its efficacy.&lt;/p&gt;

&lt;p&gt;Within the Component Store architecture, we find four essential components:&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;State&lt;/strong&gt;: The cornerstone of our data management, encompassing all information vital to the component's functionality.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Selectors&lt;/strong&gt;: extract specific data from the component's state, enabling convenient and efficient access to relevant information.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Updaters&lt;/strong&gt;: modifying the component's state, facilitating seamless updates and modifications.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Effects&lt;/strong&gt;: handle side effects, ensuring the integrity and stability of the component's state and behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The state, along with its functionalities, is presented as observables, enabling components to observe and react to state changes.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;💥 &lt;strong&gt;What are the benefits of the component store? What makes it so powerful to use?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;😊 &lt;strong&gt;Simplicity&lt;/strong&gt;: It offers a straightforward approach to managing component state, keeping complexity at bay while ensuring efficient state management.&lt;br&gt;
😊 &lt;strong&gt;Maintenance&lt;/strong&gt;: in a direct context to simplicity, it is so comfortable to make some changes and update the service whenever we want. &lt;br&gt;
😊 &lt;strong&gt;Performance&lt;/strong&gt;: Leveraging Agular’s change detection mechanism and observables, Component Store ensures swift state updates and judicious component re-renders, enhancing overall application performance. Moreover, the component state persists as long as the component is active, ensuring efficient resource management.&lt;br&gt;
😊 &lt;strong&gt;Encapsulation&lt;/strong&gt;: Its ability to instantiate multiple instances of the same component, each with its independent state managed within its Component Store, promotes encapsulation and modularity, contributing to a clean and organized codebase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In summary&lt;/strong&gt;, the Component Store offers an elegant solution for managing component state, combining simplicity, efficiency, and encapsulation to elevate the development experience.&lt;/p&gt;

&lt;p&gt;💥 &lt;strong&gt;Now that we grasp the capabilities of the Component Store, let's dive into the implementation.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1️⃣ Begin by defining the managed state within the Component Store and initializing it accordingly. (Feel free to expand upon the state structure as needed.)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5qly9wxibck6oqy4gswh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5qly9wxibck6oqy4gswh.png" alt="Image description" width="800" height="421"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This initial state serves as the foundation, ready to scale as needed, accommodating additional details seamlessly.&lt;/p&gt;

&lt;p&gt;Omit the providedIn property in the @Injectable decorator, as the Component Store is intended to be provided at the component level.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;While a user type hasn't been created for this example, adhering to best practices dictates that all components should be appropriately typed, and the usage of "any" should be avoided at all costs. *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;2️⃣ In our next step, we'll implement selectors to efficiently retrieve data from the state. Leveraging observables, these selectors will ensure a reactive approach, allowing for seamless and elegant handling of data, thereby enhancing both responsiveness and overall user experience.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ockkduw8af56iwt50t7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2ockkduw8af56iwt50t7.png" alt="Image description" width="800" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3️⃣ Now, let's proceed to define our state updaters, and notice their cleanliness and readability.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7hqc0xytnhcm1g1kevkz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7hqc0xytnhcm1g1kevkz.png" alt="Image description" width="800" height="387"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do not forget to make validations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;4️⃣ The final step in setting up the service store involves implementing side-effects. These serve crucial functions such as handling asynchronous operations and managing component state based on external events or data changes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frk1yre9ie2cw8p16lxjg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frk1yre9ie2cw8p16lxjg.png" alt="Image description" width="800" height="479"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The 'setUser' effect, for instance, is responsible for receiving user data and updating the component's state. I've included a 'loading' state as an illustrative example of how we can manage the waiting period for data retrieval from the server.&lt;br&gt;
Another aspect I find particularly satisfying to handle within the store is the 'editButtonStatus' effect. This continuously updates the button's state in the view, determining whether it should be enabled or disabled.&lt;br&gt;
It's worth noting that there's significant potential for customization and manipulation of data streams within these effects using operators. This allows for fine-tuning and tailoring the data flow to precisely fit the requirements of the application.&lt;/p&gt;

&lt;p&gt;5️⃣ Now, the last thing, we going to inject the store inside our component and use the selectors and effects. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzz32lfhuzoh3jidq8ght.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzz32lfhuzoh3jidq8ght.png" alt="Image description" width="800" height="537"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When dealing with a child component, simply injecting the store service suffices, eliminating the need for explicit provision, especially when aiming to leverage the same store instance.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>angular</category>
      <category>rxjs</category>
      <category>reactive</category>
      <category>frontend</category>
    </item>
    <item>
      <title>Understanding Observables: A Real-Life Perspective</title>
      <dc:creator>Asaf Eliasim</dc:creator>
      <pubDate>Mon, 12 Feb 2024 08:05:53 +0000</pubDate>
      <link>https://dev.to/asaf_eliasim/understanding-observables-a-real-life-perspective-8mp</link>
      <guid>https://dev.to/asaf_eliasim/understanding-observables-a-real-life-perspective-8mp</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;br&gt;
In the realm of modern web development, asynchronous programming plays a pivotal role in creating responsive and interactive applications. However, managing asynchronous operations and handling data streams can often become complex and challenging. This is where the concept of &lt;strong&gt;observables&lt;/strong&gt; comes into play, offering powerful and intuitive solutions to deal with asynchronous data flows. In this article, we will explore the concept of observables, understand why they are used, and delve into real-life examples to illustrate their relevance and importance. &lt;/p&gt;

&lt;p&gt;so...&lt;br&gt;
&lt;strong&gt;What is an Observable❓&lt;/strong&gt;&lt;br&gt;
At its core, an observable is a representation of a data stream that emits multiple values over time. Think of it as a pipeline through which data flows continuously, with the ability to emit values, errors, and completion signals. Much like a water pipe carrying water from one point to another, an observable stream facilitates the flow of data from its source to the consumer, allowing for seamless communication and interaction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why do we use Observables❓&lt;/strong&gt;&lt;br&gt;
Observables are used in programming for several reasons, primarily to handle asynchronous operations and manage data streams effectively. They offer a range of benefits, including: &lt;/p&gt;

&lt;p&gt;✔ &lt;strong&gt;Asynchronous Operations Handling&lt;/strong&gt;: &lt;br&gt;
Observables provide a structured and consistent way to handle asynchronous tasks such as HTTP requests, user interactions, and timers, making it easier to manage complex asynchronous workflow.&lt;/p&gt;

&lt;p&gt;✔ &lt;strong&gt;Reactive Programming&lt;/strong&gt;: &lt;br&gt;
Observables are a fundamental concept in reactive programming, enabling developers to build responsive and scalable applications by reacting to changes in data streams in a declarative and composable manner.&lt;/p&gt;

&lt;p&gt;✔ &lt;strong&gt;Error Handling&lt;/strong&gt;: &lt;br&gt;
Observables come with built-in error handling mechanisms, allowing developers to handle errors gracefully within the data stream and propagate them as needed, ensuring robust error handling throughout the application.&lt;/p&gt;

&lt;p&gt;✔ &lt;strong&gt;Data Transformation and Composition&lt;/strong&gt;: &lt;br&gt;
Observable offers a rich set of operators for transforming, filtering, combining, and composing data streams, enabling developers to manipulate and process data with ease and efficiency. &lt;/p&gt;

&lt;p&gt;✔ &lt;strong&gt;Cancellation and Resource Management&lt;/strong&gt;: &lt;br&gt;
Observable support cancellation, enabling developers to unsubscribe from data streams when they are no longer needed, thus preventing memory leaks and optimizing resource usage. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why do we use Observable❓&lt;/strong&gt;&lt;br&gt;
Observables are used in various scenarios where asynchronous data handling is required. some common use cases include: &lt;/p&gt;

&lt;p&gt;❕ Handling HTTP requests and responses in web applications. &lt;/p&gt;

&lt;p&gt;❕ Managing user interactions such as mouse clicks, keyboard inputs, and touch events. &lt;/p&gt;

&lt;p&gt;❕ Processing real-time data streams from sources like sensors, IoT devices, or web sockets. &lt;/p&gt;

&lt;p&gt;❕ Implementing reactive user interfaces that react to changes in data and events. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Real-Life Example 🤸‍♂️: &lt;br&gt;
Water Pipes 🚿 to understand observable better&lt;/strong&gt;&lt;br&gt;
Let's consider the analogy of water pipes in a plumbing system. Imagine a network of interconnected pipes transporting water from a source. such as a reservoir, to various destinations. such as homes, businesses, and public facilities. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5eysh5wior0vnvfx211.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc5eysh5wior0vnvfx211.jpg" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Data Stream&lt;/strong&gt;&lt;br&gt;
In this analogy, the flow of water through the pipes represents the data stream. Similar to how water flows continuously through the pipes, data streams emit values over time. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Source and Destination&lt;/strong&gt;&lt;br&gt;
The source of the water (reservoir) and the destination (home, businesses) represent the observable and observer respectively. The observable emits values (water) that are observed and consumed by the observer (homes, businesses). &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Flow Control&lt;/strong&gt;&lt;br&gt;
Just as valves and controls regulate the flow of water in the pipes, operators in observables control the flow of data by transforming, filtering, and manipulating the emitted values. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Error Handling&lt;/strong&gt;&lt;br&gt;
In the event of a leak or malfunction in the pipes, the plumbing system is equipped with mechanisms to detect and address errors. Similarly, observables handle errors within the data stream, ensuring smooth and error-free data flow. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;For summary and conclusion&lt;/strong&gt;&lt;br&gt;
Observables offer a powerful and intuitive way to handle asynchronous data streams in modern web applications. By understanding the concept of observables and their real-life analogies, developers can leverage their benefits to create more responsive, scalable, and robust applications. Whether it's managing HTTP requests, processing real-time data, or reacting to user interactions, observables provide a flexible and efficient solution for handling asynchronous tasks effectively. &lt;/p&gt;

</description>
      <category>angular</category>
      <category>rxjs</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
