Frank Jusnes
Frank Jusnes

Reputation: 185

NgRx live example fails with error message "Property 'store' is used before its initialization

I'm just getting started with NgRx and I'm struggling with the live example in the Walkthrough of NgRx (https://ngrx.io/guide/store/walkthrough). It fails with the following error message:

Property 'store' is used before its initialization.

Does anyone know how to fix it? I have created a StackBlitz fork here:

https://stackblitz.com/edit/angular-wstvmm?file=src/app/app.component.ts

Upvotes: 2

Views: 1058

Answers (1)

Kohey
Kohey

Reputation: 26

try

  books$;
  bookCollection$;
  
  constructor(private booksService: GoogleBooksService, private store: Store) {
    this.books$ = this.store.select(selectBooks);
    this.bookCollection$ = this.store.select(selectBookCollection);
  }

Upvotes: 1

Related Questions