Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
NgRx v8を使ってみよう
Search
puku0x
September 11, 2019
Technology
1
1.1k
NgRx v8を使ってみよう
https://ng-fukuoka.connpass.com/event/144382/
puku0x
September 11, 2019
Tweet
Share
More Decks by puku0x
See All by puku0x
生成AIではじめるテスト駆動開発
puku0x
0
740
実践!カスタムインストラクション&スラッシュコマンド
puku0x
2
2.4k
Nx × AI によるモノレポ活用 〜コードジェネレーター編〜
puku0x
0
1.4k
ファインディにおけるフロントエンド技術選定の歴史
puku0x
2
250
ファインディでのGitHub Actions活用事例
puku0x
9
3.6k
Findyの開発生産性向上への取り組み ~Findyフロントエンドの場合~
puku0x
0
450
Findyの開発生産性を上げるためにやったこと
puku0x
1
630
Angularコーディングスタイルガイドはいいぞ
puku0x
1
400
Nx CloudでCIを爆速にした話
puku0x
0
930
Other Decks in Technology
See All in Technology
マイクロサービスへの5年間 ぶっちゃけ何をしてどうなったか
joker1007
21
8.2k
[Neurogica] 採用ポジション/ Recruitment Position
neurogica
1
130
松尾研LLM講座2025 応用編Day3「軽量化」 講義資料
aratako
6
3.7k
テストセンター受験、オンライン受験、どっちなんだい?
yama3133
0
170
SQLだけでマイグレーションしたい!
makki_d
0
1.2k
20251219 OpenIDファウンデーション・ジャパン紹介 / OpenID Foundation Japan Intro
oidfj
0
500
Kiro を用いたペアプロのススメ
taikis
4
1.9k
LayerX QA Night#1
koyaman2
0
260
SREが取り組むデプロイ高速化 ─ Docker Buildを最適化した話
capytan
0
150
Amazon Quick Suite で始める手軽な AI エージェント
shimy
1
1.9k
AWSインフルエンサーへの道 / load of AWS Influencer
whisaiyo
0
220
日本の AI 開発と世界の潮流 / GenAI Development in Japan
hariby
1
480
Featured
See All Featured
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
35
AI: The stuff that nobody shows you
jnunemaker
PRO
1
24
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
49
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
580
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
57
40k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
860
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.5k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
190
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
28
The Spectacular Lies of Maps
axbom
PRO
1
400
Transcript
NgRx v8を使ってみよう Angularもくもく会 in Fukuoka #9
Noriyuki Shinpuku ng-fukuoka organizer VEGA corporation Co., Ltd. @puku0x
Angular
Full-fledged & opinionated Angular Protractor Forms PWA Augury Language Services
Router Elements CDK Universal Karma Labs Compiler i18n Http Material Animations CLI
State management?
RxJS
Basic state management • BehaviorSubject • ReplaySubject ◦ No initial
value ◦ No current value getter
BehaviorSubject import { Injectable } from '@angular/core'; import { BehaviorSubject
} from 'rxjs'; @Injectable({ providedIn: 'root' }) export class CouterService { private counter = new BehaviorSubject(0); // Initial value = 0 get counter$() { return this.counter.asObservable(); } increment() { const value = this.counter.getValue(); this.counter.next(value + 1); } }
ReplaySubject import { Injectable } from '@angular/core'; import { BehaviorSubject
} from 'rxjs'; @Injectable({ providedIn: 'root' }) export class CouterService { private counter = new ReplaySubject(1); // Buffer size = 1 get counter$() { return this.counter.asObservable(); } setCounter(value: number) { this.counter.next(value); } }
Complex state management?
None
NgRx • RxJS powered Redux for Angular • Type-safe and
performant • Community driven
None
Does it have many boilerplates?
NgRx v8 has less boilerplates!
https://blog.angularindepth.com/ngrx-action-creators-redesigned-d396960e46da
Action creator factory import { createAction, props } from '@ngrx/store';
export const increment = createAction( '[Counter] Increment' ); export const setValue = createAction( '[Counter] Set value, props<{ value: number }>() );
Reducer creator factory import { createReducer, on } from '@ngrx/store';
import { increment, setValue } from './counter.actions'; export const initialState = 0; const counterReducer = createReducer(initialState, on(increment, state => state + 1), // No more switch-case! on(setValue, (state, { value }) => value) );
Effect creator factory import { Actions, ofType, createEffect } from
'@ngrx/effects'; import { tap } from 'rxjs/operators'; import { setValue } from '../actions'; @Injectable() export class CounterEffects { constructor(private actions$: Actionn) {} setValue$ = createEffect(() => // No more @Effect decorator! this.actions$.pipe( ofType(setValue), tap(({ value }) => console.log(`${value}`)) ), { dispatch: false } );
Creator factories make NgRx simple!
Recap • NgRx provides Redux for Angular • Less boilerplate
with creator factories • Try it now! https://ngrx.io/ https://stackblitz.com/edit/ngrx-todo-v8
Thank you! @puku0x Noriyuki Shinpuku