Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Successful with Signals: 3 Rules for Your Archi...

Successful with Signals: 3 Rules for Your Architecture

Manfred Steyer

October 02, 2024
Tweet

More Decks by Manfred Steyer

Other Decks in Programming

Transcript

  1. 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
  2. Component With Signals flights = signal<Flight[]>([]); const flights = await

    this.flightService.findAsPromise(from, to); this.flights.set(flights); <div *ngFor="let f of flights()"> <flight-card [item]="f" /> </div>
  3. Why Effects are Problematic Here? Glitch-free property: Events might get

    lost Auto-Tracking Cycles and change cascades Effect: End of the „reactive chain“
  4. Alternative Use event behind signal change Use RxJS Use reactive

    helpers rxMethod (SignalStore), ngxtension, Angular itself will get some
  5. Stores Streamline Reactive Flow Component Store Trigger Signal sync/ async

    computed() computed() Currently: Main Use Case for Signals
  6. 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: angulararchitects.io/workshop-de English Version: angulararchitects.io/workshop-en
  7. 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