Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Leveraging the new NGRX Signal Store
Search
Manfred Steyer
PRO
January 18, 2024
Programming
0
210
Leveraging the new NGRX Signal Store
Manfred Steyer
PRO
January 18, 2024
Tweet
Share
More Decks by Manfred Steyer
See All by Manfred Steyer
Successful with Signals: 3 Rules for Your Architecture
manfredsteyer
PRO
0
30
Successful with Signals: 3 Rules for Your Architecture @.NET UserGroup Bern
manfredsteyer
PRO
0
18
Improving Your Architecture with Forensic Analysis
manfredsteyer
PRO
0
61
Micro Frontends Unmasked: Opportunities, Challenges, Alternatives
manfredsteyer
PRO
0
250
Modern Angular with the NGRX Signal Store New Rules for Your Architecture @BASTA 2024 in Mainz
manfredsteyer
PRO
0
24
Modern Angular with the NGRX Signal Store New Rules for Your Architecture @BASTA! 2024 in Mainz
manfredsteyer
PRO
0
320
Successful with Signals: 3 Patterns for Your Architecture
manfredsteyer
PRO
0
93
Native Federation: The Future of Micro Frontends in Angular
manfredsteyer
PRO
0
340
Architectures with Lightweight Stores: New Rules and Options
manfredsteyer
PRO
0
290
Other Decks in Programming
See All in Programming
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
0
130
ファーストペンギンBot @Qiita Hackathon 2024 予選
dyson_web
0
200
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
840
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
1.1k
データサイエンスのフルサイクル開発を実現する機械学習パイプライン
xcnkx
2
450
Modern Functional Fluent CFML REST by Luis Majano
ortus24
0
110
Pythonで改めて考える「クラス(class)」の使いどころ
os1ma
13
3.4k
全方位強化 Python 服務可觀測性:以 FastAPI 和 Grafana Stack 為例
blueswen
1
360
Infrastructure as Code でセキュリティを楽にしよう!
konokenj
5
1.4k
上手に付き合うコンポーネントテスト
quramy
3
1.2k
M5Stackボードの選び方
tanakamasayuki
0
200
Removing Corepack
yosuke_furukawa
PRO
9
1.1k
Featured
See All Featured
Docker and Python
trallard
40
3k
How To Stay Up To Date on Web Technology
chriscoyier
786
250k
A better future with KSS
kneath
235
17k
BBQ
matthewcrist
84
9.2k
Agile that works and the tools we love
rasmusluckow
327
21k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.6k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Into the Great Unknown - MozCon
thekraken
30
1.4k
From Idea to $5000 a Month in 5 Months
shpigford
380
46k
YesSQL, Process and Tooling at Scale
rocio
167
14k
The Cost Of JavaScript in 2023
addyosmani
43
5.8k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
225
22k
Transcript
@ManfredSteyer ManfredSteyer Leveraging the new NGRX Signal Store
@ManfredSteyer Signal as Producer 4711 Consumer read set notify 4712
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer Manfred Steyer
@ManfredSteyer
@ManfredSteyer @Injectable({ providedIn: 'root' }) export class FlightBookingFacade { private
state = signalState({ from: 'Paris', to: 'London', flights: [] as Flight[], basket: {} as Record<number, boolean>, }); readonly flights = this.state.flights; readonly from = this.state.from; […] }
@ManfredSteyer @Injectable({ providedIn: 'root' }) export class FlightBookingFacade { […]
readonly selected = computed( () => this.flights().filter((f) => this.basket()[f.id]) ); […] }
@ManfredSteyer @Injectable({ providedIn: 'root' }) export class FlightBookingFacade { […]
updateCriteria(from: string, to: string): void { patchState(this.state, { from, to }) } […] }
@ManfredSteyer @Injectable({ providedIn: 'root' }) export class FlightBookingFacade { […]
updateCriteria(from: string, to: string): void { patchState(this.state, (state) => ({ from: state.to, to: state.from })); } […] }
@ManfredSteyer @Injectable({ providedIn: 'root' }) export class FlightBookingFacade { […]
updateCriteria(from: string, to: string): void { patchState(this.state, updateRoute(from, to)); } […] } function updateRoute<T>(from: string, to: string) { return (state: T) => ({ from: to, to: from }) }
@ManfredSteyer
@ManfredSteyer export const FlightBookingStore = signalStore( { providedIn: 'root' },
[…] );
@ManfredSteyer export const FlightBookingStore = signalStore( { providedIn: 'root' },
withState({ from: 'Paris', to: 'London', […] }), […] );
@ManfredSteyer export const FlightBookingStore = signalStore( { providedIn: 'root' },
withState({ from: 'Paris', to: 'London', […] }), withComputed(([…]) => ({ […] })), withMethods(([…]) => ({ })), withHooks({ […] }) );
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer const BooksStore = signalStore( withEntities({ entity: type<Flight>(), collection: 'flight'
}), );
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer Michael Egger-Zikes Rainer Hahnekamp Manfred Steyer
@ManfredSteyer Free eBook (5th Edition) ANGULARarchitects.io/book Module Federation & Nx
@ManfredSteyer Services + Signals NGRX NGRX Signal Store Different Flavors
Custom Features Typed
@ManfredSteyer d Slides & Examples Remote Company Workshops and Consulting
http://angulararchitects.io