How to call selector inside selector in ngrx?
I have selectors from the adapter:
const { selectAll, selectEntities } = productAdapter.getSelectors();
And another selectors to get the products and then the product by id I pass in the props.
const getProductsEntities = createSlector(getProductState, (state) => selectEntites(state));
const selectProductById = createSelector(getProductsEntities , (entities, props) => {
return entities[props?.productId]
});
Now I want to do another selector and use the selectProductById selector.
const selectProductViewById = createSelector(
selectProductById,
(product) => {
...
}
)
productView$ = this.store.pipe(select(selectProductViewById, { id: 1 });
But this is not working. Also I get error that the parameter passing is wrong.
So how to call selector inside selector with parameter?