{"id":1493,"date":"2023-09-22T05:00:00","date_gmt":"2023-09-22T12:00:00","guid":{"rendered":"https:\/\/www.angulartraining.com\/daily-newsletter\/?p=1493"},"modified":"2023-09-19T14:10:35","modified_gmt":"2023-09-19T21:10:35","slug":"introduction-to-state-management","status":"publish","type":"post","link":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/","title":{"rendered":"Introduction to State Management"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">When you work with Angular for quite some time, you realize that you implement similar services repeatedly. Most likely, you end up with services with <a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/subject-behaviorsubject-and-replaysubject\/\" target=\"_blank\" rel=\"noopener\" title=\"\">BehaviorSubjects<\/a> to store some data, and you have components that subscribe to these subjects exposed as <a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/best-practices-for-using-visibility-modifiers\/\" target=\"_blank\" rel=\"noopener\" title=\"\">read-only Observables<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you&#8217;re not at that point yet, I suggest you stop reading this article and get into the above architecture pattern first. This is a <a href=\"https:\/\/blog.angulartraining.com\/tutorial-state-management-with-observable-store-services-5ba53d87ad94\" target=\"_blank\" rel=\"noopener\" title=\"\">good reading<\/a> about what I call &#8220;<a href=\"https:\/\/blog.angulartraining.com\/tutorial-state-management-with-observable-store-services-5ba53d87ad94\" target=\"_blank\" rel=\"noopener\" title=\"\">progressive state management<\/a>,&#8221; where you get into state management little by little. Start there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once comfortable with the above, you might start thinking about <a href=\"https:\/\/ngrx.io\/\" target=\"_blank\" rel=\"noopener\" title=\"\">NgRx<\/a>, <a href=\"https:\/\/www.ngxs.io\/\" target=\"_blank\" rel=\"noopener\" title=\"\">NgXs<\/a>, or other state management libraries.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why state management?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The main goal of a state management library is to <strong>define a single way to handle data<\/strong> in your application. Instead of having your application data in multiple different services, all your data will belong in a single, massive object called <strong>state<\/strong>. That state has to follow several rules and cannot be updated directly. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">State management is all about rules and conventions created by the ancestor of all state management libraries: <a href=\"http:\/\/redux.js.org\" target=\"_blank\" rel=\"noopener\" title=\"\">Redux<\/a>. All modern libraries use similar concepts and vocabulary.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here are the three <strong>core principles of Redux<\/strong>:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Single source of truth<\/strong>: The app&#8217;s state is stored in a single object tree within a single <strong>store<\/strong>. In Angular applications, that store is usually a <strong>service <\/strong>that can be injected anywhere we want.<\/li>\n\n\n\n<li><strong>The state is read-only<\/strong>: The only way to change the state is to emit an <strong>action<\/strong>, an object describing what happened and how we want to change our state.<\/li>\n\n\n\n<li>State changes are made with <strong>pure functions<\/strong> called <strong>reducers<\/strong>. These functions take the previous state, an action, and return the next state. They return new state objects instead of mutating the previous state.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Visually, a typical Redux application works like this: A user interaction triggers an <strong>action <\/strong>that updates the global <strong>state <\/strong>using a <strong>reducer<\/strong>, and then components receive state updates to render the new data:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" src=\"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2023\/09\/ReduxDataFlowDiagram-1024x768.gif\" alt=\"\" class=\"wp-image-1497\" srcset=\"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2023\/09\/ReduxDataFlowDiagram-1024x768.gif 1024w, https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2023\/09\/ReduxDataFlowDiagram-300x225.gif 300w, https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2023\/09\/ReduxDataFlowDiagram-768x576.gif 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I know what you&#8217;re thinking at that point: That&#8217;s a lot of definitions and vocabulary. But this is what all state management libraries give us, so there&#8217;s no way around it. For instance, here are the links to these concepts in 3 different state management libraries:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>NgRx: <a href=\"https:\/\/ngrx.io\/api\/store\/State\" target=\"_blank\" rel=\"noopener\" title=\"\">State<\/a> (notice how that class extends <code>BehaviorSubject<\/code>) &#8211; <a href=\"https:\/\/ngrx.io\/api\/store\/Action\" target=\"_blank\" rel=\"noopener\" title=\"\">Action<\/a> &#8211; <a href=\"https:\/\/ngrx.io\/guide\/schematics\/reducer\" target=\"_blank\" rel=\"noopener\" title=\"\">Reducer<\/a>.<\/li>\n\n\n\n<li>NgXs: <a href=\"https:\/\/www.ngxs.io\/concepts\/state\" target=\"_blank\" rel=\"noopener\" title=\"\">State<\/a> &#8211; <a href=\"https:\/\/www.ngxs.io\/concepts\/state#defining-actions\" target=\"_blank\" rel=\"noopener\" title=\"\">Action<\/a> &#8211; <a href=\"https:\/\/www.ngxs.io\/concepts\/state#:~:text=by%20this%20function.-,For%20comparison%2C%20here%20are%20the%20two%20ways%20that%20you%20can%20invoke,%7D,-With%20a%20function\" target=\"_blank\" rel=\"noopener\" title=\"\">Reducer<\/a> (note that NgXs does not mention reducers directly and tries to simplify how they work, which is one of the reasons why it&#8217;s my state management library of choice)<\/li>\n\n\n\n<li>Redux: <a href=\"https:\/\/redux.js.org\/tutorials\/fundamentals\/part-2-concepts-data-flow#state-management\" target=\"_blank\" rel=\"noopener\" title=\"\">State<\/a> &#8211; <a href=\"https:\/\/redux.js.org\/tutorials\/fundamentals\/part-2-concepts-data-flow#actions\" target=\"_blank\" rel=\"noopener\" title=\"\">Action<\/a> &#8211; <a href=\"https:\/\/redux.js.org\/tutorials\/fundamentals\/part-2-concepts-data-flow#reducers\" target=\"_blank\" rel=\"noopener\" title=\"\">Reducer<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We&#8217;ll dive into these topics in more detail with a series of posts in the next few days\/weeks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you work with Angular for quite some time, you realize that you implement similar services repeatedly. Most likely, you end up with services with BehaviorSubjects to store some data, and you have components that subscribe to these subjects exposed as read-only Observables. If you&#8217;re not at that point yet, I suggest you stop reading [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,38,37],"tags":[],"class_list":["post-1493","post","type-post","status-publish","format-standard","hentry","category-architecture","category-ngxs","category-state-management"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"When you work with Angular for quite some time, you realize that you implement similar services repeatedly. Most likely, you end up with services with BehaviorSubjects to store some data, and you have components that subscribe to these subjects exposed as read-only Observables. If you&#039;re not at that point yet, I suggest you stop reading\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Alain Chautard\"\/>\n\t<meta name=\"google-site-verification\" content=\"SXxD3jwe28P5x4KWwWlYlHobuesNDkT6VWG1oVG1GcQ\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#article\",\"name\":\"Introduction to State Management | Angular Newsletter\",\"headline\":\"Introduction to State Management\",\"author\":{\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/author\\\/alcfeoh\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/ReduxDataFlowDiagram-1024x768.gif\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#articleImage\"},\"datePublished\":\"2023-09-22T05:00:00-07:00\",\"dateModified\":\"2023-09-19T14:10:35-07:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#webpage\"},\"articleSection\":\"Architecture, NgXs, State Management\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/category\\\/angular\\\/#listItem\",\"name\":\"Angular\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/category\\\/angular\\\/#listItem\",\"position\":2,\"name\":\"Angular\",\"item\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/category\\\/angular\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/category\\\/angular\\\/architecture\\\/#listItem\",\"name\":\"Architecture\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/category\\\/angular\\\/architecture\\\/#listItem\",\"position\":3,\"name\":\"Architecture\",\"item\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/category\\\/angular\\\/architecture\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#listItem\",\"name\":\"Introduction to State Management\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/category\\\/angular\\\/#listItem\",\"name\":\"Angular\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#listItem\",\"position\":4,\"name\":\"Introduction to State Management\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/category\\\/angular\\\/architecture\\\/#listItem\",\"name\":\"Architecture\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/#organization\",\"name\":\"Angular Training\",\"description\":\"Tutorials and updates about the Angular framework\",\"url\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/\",\"email\":\"contact@interstate21.com\",\"telephone\":\"+14089106087\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/wp-content\\\/uploads\\\/2018\\\/01\\\/blue-logo-vertical.png\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#organizationLogo\",\"width\":1234,\"height\":950},\"image\":{\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#organizationLogo\"},\"sameAs\":[\"https:\\\/\\\/www.youtube.com\\\/@AngularTraining\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/achautard\\\/\",\"https:\\\/\\\/blog.angulartraining.com\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/author\\\/alcfeoh\\\/#author\",\"url\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/author\\\/alcfeoh\\\/\",\"name\":\"Alain Chautard\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/26ae8a75f090f33d4e79871307246008907228871b691f47cf15d2e7353939fd?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Alain Chautard\"},\"sameAs\":[\"https:\\\/\\\/twitter.com\\\/alainchautard\",\"https:\\\/\\\/www.youtube.com\\\/@AngularTraining\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/achautard\\\/\"]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#webpage\",\"url\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/\",\"name\":\"Introduction to State Management | Angular Newsletter\",\"description\":\"When you work with Angular for quite some time, you realize that you implement similar services repeatedly. Most likely, you end up with services with BehaviorSubjects to store some data, and you have components that subscribe to these subjects exposed as read-only Observables. If you're not at that point yet, I suggest you stop reading\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/introduction-to-state-management\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/author\\\/alcfeoh\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/author\\\/alcfeoh\\\/#author\"},\"datePublished\":\"2023-09-22T05:00:00-07:00\",\"dateModified\":\"2023-09-19T14:10:35-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/#website\",\"url\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/\",\"name\":\"Angular Newsletter\",\"description\":\"Tutorials and updates about the Angular framework\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.angulartraining.com\\\/daily-newsletter\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Introduction to State Management | Angular Newsletter","description":"When you work with Angular for quite some time, you realize that you implement similar services repeatedly. Most likely, you end up with services with BehaviorSubjects to store some data, and you have components that subscribe to these subjects exposed as read-only Observables. If you're not at that point yet, I suggest you stop reading","canonical_url":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"SXxD3jwe28P5x4KWwWlYlHobuesNDkT6VWG1oVG1GcQ","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#article","name":"Introduction to State Management | Angular Newsletter","headline":"Introduction to State Management","author":{"@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/author\/alcfeoh\/#author"},"publisher":{"@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2023\/09\/ReduxDataFlowDiagram-1024x768.gif","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#articleImage"},"datePublished":"2023-09-22T05:00:00-07:00","dateModified":"2023-09-19T14:10:35-07:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#webpage"},"isPartOf":{"@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#webpage"},"articleSection":"Architecture, NgXs, State Management"},{"@type":"BreadcrumbList","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.angulartraining.com\/daily-newsletter#listItem","position":1,"name":"Home","item":"https:\/\/www.angulartraining.com\/daily-newsletter","nextItem":{"@type":"ListItem","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/#listItem","name":"Angular"}},{"@type":"ListItem","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/#listItem","position":2,"name":"Angular","item":"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/architecture\/#listItem","name":"Architecture"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.angulartraining.com\/daily-newsletter#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/architecture\/#listItem","position":3,"name":"Architecture","item":"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/architecture\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#listItem","name":"Introduction to State Management"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/#listItem","name":"Angular"}},{"@type":"ListItem","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#listItem","position":4,"name":"Introduction to State Management","previousItem":{"@type":"ListItem","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/architecture\/#listItem","name":"Architecture"}}]},{"@type":"Organization","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/#organization","name":"Angular Training","description":"Tutorials and updates about the Angular framework","url":"https:\/\/www.angulartraining.com\/daily-newsletter\/","email":"contact@interstate21.com","telephone":"+14089106087","logo":{"@type":"ImageObject","url":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-content\/uploads\/2018\/01\/blue-logo-vertical.png","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#organizationLogo","width":1234,"height":950},"image":{"@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#organizationLogo"},"sameAs":["https:\/\/www.youtube.com\/@AngularTraining","https:\/\/www.linkedin.com\/in\/achautard\/","https:\/\/blog.angulartraining.com\/"]},{"@type":"Person","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/author\/alcfeoh\/#author","url":"https:\/\/www.angulartraining.com\/daily-newsletter\/author\/alcfeoh\/","name":"Alain Chautard","image":{"@type":"ImageObject","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/26ae8a75f090f33d4e79871307246008907228871b691f47cf15d2e7353939fd?s=96&d=mm&r=g","width":96,"height":96,"caption":"Alain Chautard"},"sameAs":["https:\/\/twitter.com\/alainchautard","https:\/\/www.youtube.com\/@AngularTraining","https:\/\/www.linkedin.com\/in\/achautard\/"]},{"@type":"WebPage","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#webpage","url":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/","name":"Introduction to State Management | Angular Newsletter","description":"When you work with Angular for quite some time, you realize that you implement similar services repeatedly. Most likely, you end up with services with BehaviorSubjects to store some data, and you have components that subscribe to these subjects exposed as read-only Observables. If you're not at that point yet, I suggest you stop reading","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/#website"},"breadcrumb":{"@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/#breadcrumblist"},"author":{"@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/author\/alcfeoh\/#author"},"creator":{"@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/author\/alcfeoh\/#author"},"datePublished":"2023-09-22T05:00:00-07:00","dateModified":"2023-09-19T14:10:35-07:00"},{"@type":"WebSite","@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/#website","url":"https:\/\/www.angulartraining.com\/daily-newsletter\/","name":"Angular Newsletter","description":"Tutorials and updates about the Angular framework","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.angulartraining.com\/daily-newsletter\/#organization"}}]}},"aioseo_meta_data":{"post_id":"1493","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-09-18 17:52:46","updated":"2025-06-03 23:52:09","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/\" title=\"Angular\">Angular<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/architecture\/\" title=\"Architecture\">Architecture<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tIntroduction to State Management\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.angulartraining.com\/daily-newsletter"},{"label":"Angular","link":"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/"},{"label":"Architecture","link":"https:\/\/www.angulartraining.com\/daily-newsletter\/category\/angular\/architecture\/"},{"label":"Introduction to State Management","link":"https:\/\/www.angulartraining.com\/daily-newsletter\/introduction-to-state-management\/"}],"_links":{"self":[{"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts\/1493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/comments?post=1493"}],"version-history":[{"count":4,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts\/1493\/revisions"}],"predecessor-version":[{"id":1500,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/posts\/1493\/revisions\/1500"}],"wp:attachment":[{"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/media?parent=1493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/categories?post=1493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.angulartraining.com\/daily-newsletter\/wp-json\/wp\/v2\/tags?post=1493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}