Resort Selectors

NgRx Effects

Resort Selectors

Create selectors to:

  • Access the resort feature state.
  • Access the error object.
  • Access the loading boolean value.
  • Access the searchResults array.

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);

Copyright

Site © by LiveLoveApp, LLC

We Can Help!

Need help with your Angular and NgRx project?

Hire Us