Instead of having one line for each declaration and another for assignment, I prefer to do all that at once. Here's how your example would look like:
export class FindBookPageComponent { searchQuery$: Observable<string> = this.store.pipe( select(fromBooks.selectSearchQuery), take(1) ); books$: Observable<Book[]> = this.store.pipe( select(fromBooks.selectSearchResults) ); loading$: Observable<boolean> = this.store.pipe( select(fromBooks.selectSearchLoading) ); error$: Observable<string> = this.store.pipe( select(fromBooks.selectSearchError) ); constructor(private store: Store<fromBooks.State>) {} search(query: string) { this.store.dispatch(FindBookPageActions.searchBooks({ query })); } }
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Instead of having one line for each declaration and another for assignment, I prefer to do all that at once. Here's how your example would look like: