Skip to main content

relatedEntitySelector

relatedEntitySelector is a function which creates a predefined relationship selector factory. Its goal is to simply the process of creating relationship selectors with relatedEntity.

declare function relatedEntitySelector(  entityStateSelector,  keyId,  keyValue,);

Its parameters are the same as relatedEntity has, but without relationships.

const user = rootEntitySelector(  selectUserState,);const userCompany = relatedEntitySelector(  selectCompanyState,  'companyId',  'company',);
// later.const user1 = user(  userCompany(),);
// the same as.const user2 = rootEntity(  userSelector,  relatedEntity(    companySelector,    'companyId',    'company',  ),);