In the ngRx Sample App: https://github.com/ngrx/example-app
Here we have this selector in Reducers-> Index.ts :
Now, the getBooksState is in Reducers-> Index.ts :
When we have the Book state handy, we can use the “fromBooks.getEntities” to get the Entities of that bookThe Book state has the Entities object, so if we have the book state, there’s no need for any selector.
- The use of the fromBooks.getEntities selector which returns just the entities object of all books, is only so that that getBookEntities can compose the act of getting books and getting entities from those books.
You don’t need reselect
select() method will give you an observable that calls
distinctUntilChanged() internally, meaning they will only fire when the state actually changes. ( it means when there is a new reference ).