Helion


Szczegóły ebooka

Reactive Patterns with RxJS for Angular

Reactive Patterns with RxJS for Angular


RxJS is a fast, reliable, and compact library for handling asynchronous and event-based programs. It is a first-class citizen in Angular and enables web developers to enhance application performance, code quality, and user experience, so using reactive patterns in your Angular web development projects can improve user interaction on your apps, which will significantly improve the ROI of your applications.

This book is a step-by-step guide to learning everything about RxJS and reactivity. You'll begin by understanding the importance of the reactive paradigm and the new features of RxJS 7. Next, you'll discover various reactive patterns, based on real-world use cases, for managing your application's data efficiently and implementing common features using the fewest lines of code.

As you build a complete application progressively throughout the book, you'll learn how to handle your app data reactively and explore different patterns that enhance the user experience and code quality, while also improving the maintainability of Angular apps and the developer's productivity. Finally, you'll test your asynchronous streams and enhance the performance and quality of your applications by following best practices.

By the end of this RxJS Angular book, you'll be able to develop Angular applications by implementing reactive patterns.

  • Contributors
    • About the author
    • About the reviewer
  • Preface
    • Who this book is for
    • What this book covers
    • To get the most out of this book
    • Download the example code files
    • Download the color images
    • Conventions used
    • Get in touch
    • Share Your Thoughts
  • Part 1 Introduction
  • Chapter 1: The Power of the Reactive Paradigm
    • Technical requirements
    • Exploring the pillars of reactive programming
      • Data streams
      • Observer patterns
    • Using RxJS in Angular and its advantages
      • The HTTP client module
      • The router module
      • Reactive forms
      • The event emitter
      • The async pipe
    • Learning about the marble diagram our secret weapon
    • Summary
  • Chapter 2: RxJS 7 The Major Features
    • Technical requirements
    • Exploring the bundle size improvements
    • Reviewing the TypeScript typing improvements
    • Understanding the toPromise() deprecation
      • The firstValueFrom() method
      • The lastValueFrom() method
      • Empty errors
    • Highlighting API consistency improvements
    • Summary
  • Chapter 3: A Walkthrough of the Application
    • Technical requirements
    • Our apps user stories
      • View one the landing page
      • View two the new recipe interface
      • View three the My Recipes interface
      • View four the My Favourites interface
      • View five the modify recipe interface
      • View six the recipe details interface
    • Our app's architecture
    • The components overview
    • Summary
  • Part 2 A Trip into Reactive Patterns
  • Chapter 4: Fetching Data as Streams
    • Technical requirements
    • Defining the requirement
    • Exploring the classic pattern for fetching data
      • Defining the structure of your data
      • Creating an Angular service
      • Retrieving the data through a method
      • Injecting and subscribing to the service in your component
      • Displaying the data in the template
      • Managing unsubscriptions
    • Exploring the reactive pattern for fetching data
      • Retrieving data as streams
      • Defining the stream in your component
      • Using the async pipe in your template
    • Highlighting the advantages of the reactive pattern
      • Using the declarative approach
      • Using the change detection strategy of OnPush
      • Wrapping up
    • Summary
  • Chapter 5: Error Handling
    • Technical requirements
    • Understanding the anatomy of an Observable
    • Exploring error handling patterns and strategies
      • Handling error operators
      • The catchError operator
      • The delayWhen operator
    • Error handling in action
    • Summary
  • Chapter 6: Combining Streams
    • Technical requirements
    • Defining the requirement
    • Exploring the imperative pattern for filtering data
      • A look at the filter component
      • A look at the recipes list component
    • Exploring the declarative pattern for filtering data
      • The combineLatest operator
      • The declarative pattern pillars
      • Emitting a value when an action occurs
    • Summary
  • Chapter 7: Transforming Streams
    • Technical requirements
    • Defining the requirement
    • Exploring the imperative pattern for autosave
    • Exploring the reactive pattern for autosave
      • Higher-order observables
      • Higher-order mapping operators
      • The concatMap operator
    • Learning about other useful higher-order mapping operators
      • The mergeMap operator
      • The switchMap operator
      • The exhaustMap operator
    • Summary
  • Part 3 Multicasting Takes You to New Places
  • Chapter 8: Multicasting Essentials
    • Technical requirements
    • Explaining Multicasting versus Unicasting
      • Producer
      • A cold observable
      • A hot observable
    • Exploring Subjects
      • A plain Subject
      • ReplaySubject
      • BehaviorSubject
    • Highlighting Multicasting operators
    • Summary
  • Chapter 9: Caching Streams
    • Technical requirements
    • Defining the requirement
    • Learning about using the reactive pattern to cache streams
    • Exploring the RxJS 7 recommended pattern to cache streams
    • Highlighting the use cases of caching streams
    • Summary
  • Chapter 10: Sharing Data between Components
    • Technical requirements
    • Defining the requirement
    • Exploring the reactive pattern to share data
      • Step one creating a shared service
      • Step two updating the last-selected recipe
      • Step three consuming the last-selected recipe
    • Highlighting other ways for sharing data
    • Summary
  • Chapter 11: Bulk Operations
    • Technical requirements
    • Defining the requirement
    • Learning about the reactive pattern for bulk operations
      • The forkJoin operator
      • The pattern in action
    • Learning about the reactive pattern for tracking progress
    • Summary
  • Chapter 12: Processing Real-Time Updates
    • Technical requirements
    • Defining the requirement
    • Learning the reactive pattern for consuming real-time messages
      • The WebSocketSubject behavior
      • Connection management
      • Putting the pattern into action
    • Learning the reactive pattern for handling reconnection
      • Retrying the reconnection
    • Summary
  • Part 4 Final Touch
  • Chapter 13: Testing RxJS Observables
    • Technical requirements
    • Learning about the subscribe and assert pattern
    • Learning about the marble testing pattern
      • Understanding the syntax
      • Implementing marble tests
    • Highlighting testing streams using HttpClientTestingModule
    • Summary
    • Why subscribe?
  • Other Books You May Enjoy
    • Packt is searching for authors like you
    • Share Your Thoughts

  • Tytuły: Reactive Patterns with RxJS for Angular
  • Autor: Lamis Chebbi
  • Tytuł oryginału: Reactive Patterns with RxJS for Angular
  • ISBN Ebooka: 9781801814225, 9781801814225
  • Data wydania: 2022-04-29
  • Identyfikator pozycji: e_2t7i
  • Kategorie:
  • Wydawca: Packt Publishing