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
ngxs
Search
Jecelyn Yeen
January 10, 2019
Programming
0
740
ngxs
ngxs - state management made simple
Jecelyn Yeen
January 10, 2019
Tweet
Share
More Decks by Jecelyn Yeen
See All by Jecelyn Yeen
WorkerConf 2021 - Browser automation with Puppeteer
jecfish
0
1.8k
My Journey as Technical Presenter
jecfish
0
950
Becoming a GDE
jecfish
0
3.8k
How to get started in IT Freelancing
jecfish
1
270
New Web API & Stylings
jecfish
3
700
如何打造高性能且SEO友好的单页应用(SPA)
jecfish
2
850
JS SEO
jecfish
4
1.5k
Web Performance Optimization
jecfish
5
1.8k
Have Fun with Angular
jecfish
0
100
Other Decks in Programming
See All in Programming
なぜ強調表示できず ** が表示されるのか — Perlで始まったMarkdownの歴史と日本語文書における課題
kwahiro
12
5.9k
イベントストーミングのはじめかた / Getting Started with Event Storming
nrslib
1
500
Nitro v3
kazupon
2
300
Tangible Code
chobishiba
3
560
Designing Repeatable Edits: The Architecture of . in Vim
satorunooshie
0
380
Promise.tryで実現する新しいエラーハンドリング New error handling with Promise try
bicstone
3
450
TVerのWeb内製化 - 開発スピードと品質を両立させるまでの道のり
techtver
PRO
3
990
All(?) About Point Sets
hole
0
150
CSC509 Lecture 10
javiergs
PRO
0
170
Eloquentを使ってどこまでコードの治安を保てるのか?を新人が考察してみた
itokoh0405
0
3.2k
しっかり学ぶ java.lang.*
nagise
1
370
OSS開発者の憂鬱
yusukebe
12
4.2k
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Visualization
eitanlees
150
16k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Become a Pro
speakerdeck
PRO
29
5.6k
Mobile First: as difficult as doing things right
swwweet
225
10k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Testing 201, or: Great Expectations
jmmastey
46
7.8k
We Have a Design System, Now What?
morganepeng
54
7.9k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
1.8k
Transcript
State Management Made Simple
@JecelynYeen - Google Developer Expert (GDE) - Blogger - Software
Architect - Women Who Code KL Director - ng-MY Conference Organizer
state management pattern + library for Angular
predictable state mutations
None
Why Yet Another State Management Solution?
Pick your flavor!
Reimagine State Management for Angular
Reduce Boilerplate
Rethink Developer Ergonomic & User API
Getting Started ng add @ngxs/schematics https://github.com/ngxs/schematics
Generate 2 files: .actions.ts, .state.ts ng generate @ngxs/schematics:store --name app
https://github.com/ngxs/schematics
Demo: Coffee https://ngxs-coffee.firebaseapp.com
Overview (State)
Overview (Actions) • [Coffee API] Get Coffee List • [List
Page] Add ToCart (coffeeName) • [Cart Page] Add One Cart Item (coffeeName) • [Cart Page] Remove One Cart Item (coffeeName) • [Cart Page] Remove Cart Item (coffeeName) • [Pay Component] Empty Cart
Overview (Actions) GetCoffeeList AddToCart AddOne RemoveOne Remove EmptyCart
Overview (Selectors) Coffee List Cart List Total Amount Total Quantity
Overview (Selectors) • [List Page] Coffee List • [Cart Page]
Cart List • [Pay Component] Total Cart Amount • [Header Component] Total Cart Quantity
Major NGXS Concepts Component Actions Store Plugins Backend dispatch m
utate select
Rxjs is awesome, but is it a must?
Effects can be painful
Make use of Dependency Injection (DI)
Making Actions Asynchronous
Plugins https://ngxs.gitbook.io/ngxs/plugins/intro
NGXS is extendable
CLI Router Storage Form Logger Websocket
Labs https://ngxs.gitbook.io/ngxs/ngxs-labs/intro
Innovation without Compromising Stability
Emitter - Get rid of Actions (until you really need
them)
Dispatch Decorator Immer Adapter
Extensive Documentation https://ngxs.gitbook.io/ngxs/
Do you know why it’s called NGXS? https://youtu.be/rkn73khwfWU?t=1582
Thanks for all contributors https://github.com/ngxs/store/graphs/contributors Austin Daniel | Mark Whitfeld
| Danny Blue | Leon Radley | Max Ivanov
Try me! > Twitter: @JecelynYeen Slides: https://speakerdeck.com/chybie/ngxs Demo: https://github.com/chybie/ngxs-coffee Demo
(Emitter): https://github.com/chybie/ngxs-coffee/tree/emitter-demo
Resources - Why another state management framework for Angular? -
NGXS official site - ngAir Live Video Podcast about NGXS - Announcing NGXS 3.1 - Announcing NGXS 3.3