i am trying to prepare a credit card application using ngRx. i have set up my actions, reducers and effects, but at the end of my reducer i encounter the above error, when i am trying to access a credit card id. The error is that the entities does not have a call back.
export const getCurrentCreditCard = createSelector(
getCreditCardFeatureState,
getCurrentCreditCardId,
state => state.entities(state.selectedCreditCardId)
);
The code is a bit much...please here is a link to the git repo. https://github.com/ProgrammeMitch/credit_card_store_ngrx Please help
I'm not too familiar with ngrx, but the error seems to indicate that state.entities
is not a method, but rather a Dictionary
.
I think maybe you simply need to use square brackets:
state => state.entities[state.selectedCreditCardId]