Slide 1

Slide 1 text

Patrick Jahr • qupaya, 26.04.2024 Angular & NgRx SignalStore

Slide 2

Slide 2 text

Patrick Jahr • qupaya, 26.04.2024 What to expect? - Small comparison of the stores - Introduction of the signal store What not to expect? - Testing

Slide 3

Slide 3 text

Patrick Jahr • qupaya, 26.04.2024 Table of contents 1. NgRx Store 2. ComponentStore 3. NgRx Signals 4. SignalStore

Slide 4

Slide 4 text

Patrick Jahr • qupaya, 26.04.2024 It´s me 💻 Senior Software Engineer @ qupaya [email protected] @jahr_patrick LinkedIn

Slide 5

Slide 5 text

Patrick Jahr • qupaya, 26.04.2024 Ngrx Store Actions, Reducers and Effects Characteristics: ● Type Safety ● Immutability & Performance ● Encapsulation ● DevTools When do i use Ngrx Store? → SHARI ● Shared ● Hydrated ● Available ● Retrieved ● Impacted

Slide 6

Slide 6 text

Patrick Jahr • qupaya, 26.04.2024 Component Store State, Selectors, Effects and Updaters Characteristics: ● Tied to the life-cycle of a particular component and is cleaned up when that component is destroyed ● Instead of reducer, available functions ○ setState ○ updater ● Effects defined as methods with or without parameters ● Performant selectors

Slide 7

Slide 7 text

Patrick Jahr • qupaya, 26.04.2024 Comparison of Store and ComponentStore Store: ● Ability to trigger multiple effects/reducers ● Useful DevTools ● Better suited for global state handling ● Single State ● File Structure separated ○ Effects ○ Reducers ○ Selectors ComponentStore: ● Manage local state ○ Component UI State ● Multiple independent states ● Single file structure ○ effects/updaters/selectors Both: ● Pushed based architecture ● Work with Observables ● Both has effects to handle side effects

Slide 8

Slide 8 text

Patrick Jahr • qupaya, 26.04.2024 NgRx Signals @ngrx/signals Features: ● SignalStore: State-Management based on Angular Signals ● SignalState: Signal based State for UI-Components and Services ● RxJS-Integration: New possibility to handle side effects with the integration of RxJS. ● Entity Management: Easy and performant way to handle Entity Data Collections

Slide 9

Slide 9 text

Patrick Jahr • qupaya, 26.04.2024 Signal Store Function based state, methods, hooks and more Characteristics: ● Simple and Intuitive: Efficient API for Angular Signals. ● Lightweight and Performant: Minimal overhead, optimal size. ● Modular, Extensible, Scalable: Independent building blocks. ● Type-safe: Compile-time error prevention.

Slide 10

Slide 10 text

Patrick Jahr • qupaya, 26.04.2024 DEMO

Slide 11

Slide 11 text

Patrick Jahr • qupaya, 26.04.2024 Thank you for having me!