Skip to main content


toFactorySelector helps to create a factory selector function from a root selector. In this case, the produced selector can be passed directly to NGRX

This function is useful for NGRX v12 and younger.

export class MyComponent {  public readonly users$: Observable<User>;
  private readonly selectUser =    toFactorySelector(      rootUser(        relUserCompany(          relCompanyAddress(),        ),      ),    );
  constructor(private store: Store) {    this.users$ =      // let's select current user      this.selectUser(        selectCurrentUserId,      ),    );  }}