I am getting the following error: substate is undefined
. However, I am not sure why substate
would be undefined in my selector. Could someone please help me figure out what might be going wrong?
Selector:
import { createSelector } from 'reselect';
/**
* Direct selector to the organization state domain
*/
const selectOrganizationDomain = () => (state) => state.get('organization');
/**
* Other specific selectors
*/
/**
* Default selector used by organization
*/
const selectOrganization = () => createSelector(
selectOrganizationDomain(),
(substate) => substate.toJS()
);
const selectChanges = () => createSelector(
selectOrganization(),
(substate) => substate.get('changes')
)
export default selectOrganization;
export {
selectOrganizationDomain,
selectChanges
};
Your
selectOrganizationDomain
should be a function that returns.get('organization')
on the state:Your composed selectors should be the result of the invocation of
createSelector
, with the other selector functions passed in as arguments tocreateSelector
: