How to get the state from the ngrx store without using the reselect createSelector
and store.select method in this example?
export const getBookCollection = createSelector(getBookEntities, getCollectionBookIds, (entities, ids) => {
return ids.map(id => entities[id]);
});
constructor(store: Store<fromRoot.State>) {
this.books$ = store.select(fromRoot.getBookCollection);
}
Using only the store.select you could do:
export const getBooksCollection = (state: State) => {
const ids = state.collection.ids;
const entities = state.books.entities;
return ids.map(id => entities[id]);
}
constructor(store: Store<fromRoot.State>) {
this.books$ = store.select(fromRoot.getBookCollection);
}