Slide 1

Slide 1 text

AngularArchitects.io | @ManfredSteyer Successful with Signals: 3 Effective Rules

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Agenda • Austrian Desserts • Computed • Effects • RxJS Interop • Stores

Slide 6

Slide 6 text

Result • 3 Rules (of thumb) • 2 Hints

Slide 7

Slide 7 text

About me… Manfred Steyer, ANGULARarchitects.io (Remote) Angular Workshops and Consulting Google Developer Expert for Angular Blog, Books, Articles, and Talks about Angular Manfred Steyer

Slide 8

Slide 8 text

Austrian Desserts: Example App

Slide 9

Slide 9 text

Demo

Slide 10

Slide 10 text

Computed

Slide 11

Slide 11 text

Simple Reactivity with Signals Signal 4711 Consumer read set notify 4712

Slide 12

Slide 12 text

Signal Eventually Zone-less!

Slide 13

Slide 13 text

flights = signal([]); const flights = await this.flightService.findAsPromise(from, to); this.flights.set(flights);

Slide 14

Slide 14 text

from = signal('Paris'); to = signal('London'); flightRoute = computed(() => this.from() + ' to ' + this.to());

Slide 15

Slide 15 text

Demo Branch: 01a-add-signals

Slide 16

Slide 16 text

Architecture Rule #1 Synchronously derive state where possible

Slide 17

Slide 17 text

Effects

Slide 18

Slide 18 text

Demo Branch: 04-effects-starter

Slide 19

Slide 19 text

Architecture Rule #2 Avoid effects propagating state and signal writes

Slide 20

Slide 20 text

RxJS-Interop

Slide 21

Slide 21 text

Demo Branch: 05-rxjs-interop-starter

Slide 22

Slide 22 text

Hint #1 Signals play well together with RxJS

Slide 23

Slide 23 text

Hint #2 Avoid Race Conditions (e.g. RxJS and/or loading flag)

Slide 24

Slide 24 text

Stores

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

Stores Streamline Reactive Flow Component Store "Intention" Signal sync/ async computed() computed()

Slide 29

Slide 29 text

Demo Branch: 07-state-service-starter

Slide 30

Slide 30 text

Architecture Rule #3 Stores make your reactive flow more manageable

Slide 31

Slide 31 text

Free eBook (2nd Edition) angularArchitects.io/modern

Slide 32

Slide 32 text

More: Angular Architecture Workshop • Maintainable Architectures with Modern Angular • Strategic Design with Nx & Sheriff • Micro Frontends with Module Federation • Signals and Your Architecture: CD & Zone-less, NGRX & Signal Store, RxJS-Interop German Version in June: Online & Interactive angulararchitects.io/workshop-de

Slide 33

Slide 33 text

Conclusion Architecture Rule #1 Synchronously derive state where possible Architecture Rule #2 Avoid effects propagating state and signal writes Architecture Rule #3 Stores make your reactive flow more manageable Component Store

Slide 34

Slide 34 text

Conclusion Hint #1 Signals play well together with RxJS Hint #2 Avoid Race Conditions (e.g. RxJS and/or loading flag)

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

ManfredSteyer AngularArchitects.io Slides & Examples