Created
June 13, 2022 01:24
-
-
Save thecodinganalyst/94016d953dd7d09549a657d3d0bd3b96 to your computer and use it in GitHub Desktop.
NgRx Selector Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createFeatureSelector, createSelector} from "@ngrx/store"; | |
import {BookStore} from "./books.state"; | |
const bookStore = createFeatureSelector<BookStore>('bookStore'); | |
const books = createSelector( bookStore, (bookStoreState => bookStoreState.books)); | |
const selectedBook = createSelector(bookStore, (bookStoreState => bookStoreState.selectedBook)); | |
const showDetail = createSelector(bookStore, (bookStoreState => bookStoreState.showDetail)); | |
export const Selector = { | |
bookStore, books, selectedBook, showDetail | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment