Reactive Patterns with RxJS and Angular Signals: Elevate your Angular 18 applications with RxJS Observables, subjects, operators, and Angular Signals / Реактивные паттерны с RxJS и сигналами Angular: Расширьте возможности ваших приложений Angular 18 с помощью RxJS Observables, объектов, операторов и сигналов Angular Год издания: 2024 Автор: Chebbi Lamis / Чебби Ламис Издательство: Packt Publishing ISBN: 978-1-83508-770-1 Язык: Английский Формат: PDF Качество: Издательский макет или текст (eBook) Интерактивное оглавление: Да Количество страниц: 255 Описание: Leverage the reactive paradigm with RxJS and signals in your Angular applications using common patterns and techniques designed for real-world use cases Key Features Discover practical reactive patterns to use in your Angular apps to improve the quality and performance of your code Explore the latest Angular features Learn about various RxJS operators and techniques Book Description RxJS is a powerful reactive extension for JavaScript, specializing in asynchronous and event-driven programming. This book serves as a comprehensive, step-by-step guide to learning RxJS and reactivity, helping you navigate reactive patterns, efficient data management, and the streamlined implementation of common features with minimal code. This second edition aligns with the latest version of Angular, introducing new reactive patterns based on Angular Signals, which play a pivotal role in enabling fine-grained reactivity within Angular and enhancing change detection and user interface rendering. Throughout the book, you’ll construct a complete application that incorporates the latest Angular features, such as standalone components, new built-in control flow, deferrable views, and more. You’ll focus on cultivating skills to handle data reactively, thus improving the application’s overall quality, user experience, and developer productivity. As you progress, the book covers best practices for testing asynchronous streams and optimizing app performance. By the end of this RxJS and Angular book, you’ll not only be able to develop Angular applications by implementing reactive patterns, but also grasp all the best practices, ensuring a well-rounded understanding of RxJS within the Angular framework. What you will learn Get to grips with RxJS core concepts such as Observables, subjects, and operators Use the marble diagram in reactive patterns Delve into stream manipulation, including transforming and combining them Understand memory leak problems using RxJS and best practices to avoid them Build reactive patterns using Angular Signals and RxJS Explore different testing strategies for RxJS apps Discover multicasting in RxJS and how it can resolve complex problems Build a complete Angular app reactively using the latest features of RxJS and Angular Who this book is for If you’re a developer working with Angular and RxJS, this book is for you. Designed for anyone at a beginner level in both Angular and RxJS, this book will help you gain experience and harness the potential of RxJS or benefit you if you’re looking to leverage the reactive paradigm within your Angular applications. This book assumes some familiarity with Angular, basic RxJS, and TypeScript, as well as foundational knowledge of functional programming. Используйте реактивную парадигму с помощью RxJS и сигналов в своих приложениях Angular, используя общие шаблоны и методы, разработанные для реальных случаев использования Kлючевые функции Откройте для себя практические шаблоны реагирования, которые можно использовать в ваших приложениях Angular для повышения качества и производительности вашего кода Ознакомьтесь с новейшими функциями Angular Узнайте о различных операторах и методах работы с RxJS Описание книги RxJS - это мощное реактивное расширение для JavaScript, специализирующееся на асинхронном и событийно-ориентированном программировании. Эта книга служит всеобъемлющим пошаговым руководством по изучению RxJS и реактивности, помогая вам ориентироваться в шаблонах реактивности, эффективном управлении данными и упрощенной реализации общих функций с минимальными затратами кода. Это второе издание соответствует последней версии Angular и содержит новые шаблоны реагирования, основанные на сигналах Angular, которые играют ключевую роль в обеспечении детальной реактивности в Angular и улучшении обнаружения изменений и визуализации пользовательского интерфейса. На протяжении всей книги вы будете создавать полноценное приложение, которое включает в себя новейшие функции Angular, такие как автономные компоненты, новый встроенный поток управления, отложенные просмотры и многое другое. Вы сосредоточитесь на развитии навыков оперативной обработки данных, что позволит улучшить общее качество приложения, удобство работы с пользователем и производительность разработчиков. По мере продвижения в книге будут представлены рекомендации по тестированию асинхронных потоков и оптимизации производительности приложения. К концу чтения этой книги по RxJS и Angular вы не только сможете разрабатывать приложения Angular, внедряя реактивные шаблоны, но и овладеете всеми передовыми практиками, что обеспечит всестороннее понимание RxJS в рамках Angular framework. Что вы узнаете Познакомьтесь с основными понятиями RxJS, такими как наблюдаемые, объекты и операторы Используйте диаграмму marble в реактивных шаблонах Изучите манипуляции с потоками, включая их преобразование и комбинирование Разберитесь с проблемами утечки памяти с помощью RxJS и рекомендациями по их устранению Создавайте реактивные шаблоны, используя Angular Signals и RxJS Изучите различные стратегии тестирования приложений RxJS Узнайте о многоадресной рассылке в RxJS и о том, как с ее помощью можно решать сложные проблемы Создайте полноценное приложение Angular, используя новейшие функции RxJS и Angular Для кого предназначена эта книга Если вы разработчик, работающий с Angular и RxJS, то эта книга для вас. Предназначенная для тех, кто только начинает осваивать Angular и RxJS, эта книга поможет вам приобрести опыт и использовать потенциал RxJS, а также принесет пользу, если вы хотите использовать реактивную парадигму в своих приложениях Angular. Эта книга предполагает некоторое знакомство с Angular, базовыми RxJS и TypeScript, а также базовые знания в области функционального программирования.
Примеры страниц (скриншоты)
Оглавление
Preface xiii Part 1: An Introduction to the Reactive World 1 Diving into the Reactive Paradigm 3 Technical requirements 4 Exploring the pillars of reactive programming 4 Data streams 4 Observer patterns 5 Learning about the marble diagram (our secret weapon) 6 Highlighting the use of RxJS in Angular 9 The HttpClient module 9 The Router module 10 Reactive forms 13 The Event emitter 13 Summary 14 2 Walking through Our Application 15 Technical requirements 15 Breaking down our app’s interfaces 16 View one – the landing page 16 View two – the New Recipe interface 17 View three – the My Recipes interface 18 View four – the My Favourites interface 19 View five – the Modify Recipe interface 19 View six – the Recipe Details interface 20 Reviewing our app’s architecture 20 Reviewing our app’s components 21 Summary 22 Part 2: A Trip into Reactive Patterns 3 Fetching Data as Streams 25 Technical requirements 26 Defining the data fetch requirement 27 Exploring the classic pattern for fetching data 28 Defining the structure of your data 28 Creating the fetching data service 28 Creating Angular standalone components 30 Injecting and subscribing to the service in your component 33 Displaying the data in the template 34 Managing unsubscriptions 35 Exploring the reactive pattern for fetching data 38 Retrieving data as streams 38 Defining the stream in your component 39 Using the async pipe in your template 40 Highlighting the advantages of the reactive pattern 41 Using the declarative approach 41 Using the change detection strategy of OnPush 42 Diving into the built-in control flow in Angular 17 44 Structural directives 45 Built-in control flows 46 Including built-in control flows in our recipe app 50 Benefits of built-in control flow 51 Summary 52 4 Handling Errors Reactively 53 Technical requirements 53 Understanding the anatomy of an Observable contract 54 Exploring error handling patterns and strategies 55 The replace strategy 57 The rethrow strategy 59 The retrying strategy 60 Choosing the right error handling strategy 66 Handling errors in our recipe app 68 Summary 70 5 Combining Streams 71 Technical requirements 71 Defining the filtering requirement 72 Exploring the imperative pattern for filtering data 73 Exploring the declarative pattern for filtering data 76 The combineLatest operator 78 Updating the filter value 81 Highlighting common pitfalls and best practices 84 Unnecessary subscriptions 84 Missing or incomplete values 85 Performance overhead 85 Confusing error handling 85 Summary 85 6 Transforming Streams 87 Technical requirements 87 Defining the autosave requirement 88 Exploring the imperative pattern for the autosave feature 89 Exploring the reactive pattern for the autosave feature 92 Higher-order Observables 92 Higher-order mapping operators 93 Summary 109 7 Sharing Data between Angular Components 111 Technical requirements 111 Defining the sharing data requirement 112 Exploring the reactive pattern to share data 112 Step 1 – Creating a shared service 113 Step 2 – Updating the last selected recipe 114 Step 3 – Consuming the last selected recipe 117 Wrapping up the data-sharing reactive pattern 118 Leveraging Deferrable Views in Angular 17 119 Summary 120 Part 3: The Power of Angular Signals 8 Mastering Reactivity with Angular Signals 123 Technical requirements 123 Understanding the motivation behind Signals 124 The traditional Zone.js approach 124 The new Signals approach 124 Unveiling the Signal API 125 Defining Signals 125 Creating Signals using the constructor function 126 Reading Signals 127 Modifying a writable Signal 128 Computed Signals 129 Signal effects 130 Unlocking the power of RxJS and Angular Signals 130 Understanding the behavior of toSignal() 132 Understanding the behavior of toObservable() 134 Integrating Signals into our recipe app 136 Fetching data as streams using Signals 136 Combining streams using Signals 139 Sharing data using Signals 141 Transforming streams using Signals 142 Exploring reactive data binding with Signals 144 Signal inputs 144 Model inputs 146 Signal queries 147 Summary 148 Part 4: Multicasting Adventures 9 Demystifying Multicasting 151 Technical requirements 151 Explaining multicasting versus unicasting 151 Unicasting and cold Observables 152 Multicasting and hot Observables 153 Transforming cold Observables into hot Observables 155 Exploring RxJS subjects 156 A plain subject 157 replaySubject 158 BehaviorSubject 159 Highlighting the advantages of multicasting 162 Summary 163 10 Boosting Performance with Reactive Caching 165 Technical requirements 165 Defining the caching requirement 166 Exploring the reactive pattern to cache streams 167 The shareReplay operator 167 Using shareReplay in RecipesApp 168 Customizing the shareReplay operator 170 Replacing the shareReplay operator with the share operator 172 Highlighting the use of caching for side effects 174 Summary 175 11 Performing Bulk Operations 177 Technical requirements 177 Defining the bulk operation requirements 178 Learning the reactive pattern for bulk operations 179 The forkJoin operator 180 The bulk operation reactive pattern 181 Benefits of the forkJoin operator 184 Learning the reactive pattern for tracking the bulk operation’s progress 185 Summary 187 12 Processing Real-Time Updates 189 Technical requirements 189 Defining the requirements of real time 190 Learning the reactive pattern for consuming real-time messages 191 Creating and using WebSocketSubject 191 WebSocketSubject in action 195 Learning the reactive pattern for handling reconnection 201 Summary 204 Part 5: Final Touches 13 Testing RxJS Observables 207 Technical requirements 207 Learning about the subscribe and assert pattern 208 Testing single-value output methods 208 Testing multiple-value output methods 211 Testing timed-value output methods 212 Learning about the marble testing pattern 213 Understanding the syntax 213 Introducing TestScheduler 214 Implementing marble tests 216 Testing timed-value output methods 218 Highlighting testing streams using HttpClientTestingModule 220 Summary 222 Index 225 Other Books You May Enjoy 232
Chebbi Lamis / Чебби Ламис - Reactive Patterns with RxJS and Angular Signals / Реактивные паттерны с RxJS и сигналами Angular [2024, PDF, ENG] download torrent for free and without registration
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum