A Redux-like Pattern for Managing State with Angular signals

Опубликовано: 19 Июнь 2024
на канале: Deborah Kurata
20,115
854

Now that Angular signals have been out for a while, there are patterns emerging.

In this video, we'll walk through one such pattern for managing state with signals. This Redux-like pattern leverages the best of signals and RxJS.

Links
Code: https://stackblitz.com/~/edit/rxjs-si...

YouTube video: "switchMap vs concatMap vs mergeMap":    • switchMap vs concatMap vs mergeMap ... Oh My!  

YouTube video: "Unsubscribe with takeUntilDestroyed":    • Use takeUntilDestroyed to Unsubscribe from...  

YouTube video: "Understanding Immutablity in JavaScript":    • Understanding Immutability in JavaScript  

Josh Morony's YouTube video: "Here's what I've figured out about Angular signals" which also covers a pattern based on Redux:    • Here's what I've figured out about Angular...  

Josh Morony's Article: "A New Reactive And Declarative Approach to Angular State Management": https://modernangular.com/articles/st...

Special Thanks
🌟 To Jason Warner for an early code review.
🌟 To Freddy Montes for reviewing the code prior to publication.
🌟 To Sander Elias for a deep dive into potential enhancements to this pattern. Follow him at: https://mastodon.social/@sanderelias

Content
00:00 Redux-like pattern
00:20 Sample application
01:38 Define the state
02:23 Set the initial state
03:09 Define the selectors
04:16 Identify the actions
04:56 Define a Subject
05:55 Creating the Observable pipeline
08:59 Defining reducers
12:30 Accessing state from the component
12:48 Kicking off actions from the component
13:35 Following the pattern (again)
16:13 Modifying the component
17:13 Wrap up

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
😊About Me
Hey! I'm Deborah Kurata
I'm a software developer and YouTube content creator. I speak at conferences such as VSLive and ng-conf. I write articles for freeCodeCamp. And I'm a Pluralsight author with courses in the top 10 most popular (out of 7,000+) for over 5 years. For my work in support of software developers, I've been recognized with the Microsoft Most Valuable Professional (MVP) award, and I'm a Google Developer Expert (GDE).

View my YouTube content:    / @deborah_kurata  
Contact me on Twitter:   / deborahkurata  
Find my Pluralsight courses: https://www.pluralsight.com/profile/a...
Access my freeCodeCamp articles: https://www.freecodecamp.org/news/aut...

▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
#angular
#angularsignals
#angularstatemanagementwithsignals
#rxjs
#rxjsandsignals
#signalsandrxjs
#angularstatemanagement
#angulartutorials
#statemanagement
#angularwithredux
#angularstatemanagementtutorial
#angularforbeginners
#statemanagementinangular
#angularredux
#angularstatemanagementbestpractices