Resort Selectors
Create selectors to:
- Access the
resortfeature state. - Access the
errorobject. - Access the
loadingboolean value. - Access the
searchResultsarray.
Declare Feature Selector
First, create a feature selector to access the resort top-level property in the state object:
export const resortState =
createFeatureSelector < ResortState > Features.resort;Declare Selectors
Then, using the resortState selector, create the selectors:
import {
getError,
getLoading,
getResorts,
reducer as resortReducer,
State as ResortState
} from './resort/resort.reducer';
export const resortError = createSelector(resortState, getError);
export const resortIsLoading = createSelector(resortState, getLoading);
export const searchResults = createSelector(resortState, getSearchResults);