codejump

Component Store

Preview — 3 of 10 questions

What is @ngrx/component-store and when should it be used over the global store?

AA micro version of NgRx store with no actions or effects, suitable for simple services
BA store optimized for use with Angular signals only
CA store that uses localStorage for persistence by default
DA local state management solution scoped to a component or service, with lifecycle tied to the component, for state that is not shared app-wide

What does @ngrx/router-store enable?

AConnecting the Angular Router state to the NgRx store — making router state (URL, params, query params) available as store state and dispatching router events as actions
BAutomatic generation of routes from NgRx actions
CCaching of component state across route navigations
DRoute-level access control driven by NgRx store values

How do you unit test an NgRx Effect?

AUse TestBed with StoreModule.forRoot() and dispatch real actions
BUse provideMockActions() and provideMockStore() in TestBed, providing an Observable<Action> for the actions stream
CCall the Effect method directly as a function
DUse SpyOn the Actions service and mock its pipe method

Sign up free to play

Answer all 10 questions (7 more), see explanations for every answer, and track your score.