셀렉터가있는 컨테이너가 하나 있고 다른 셀렉터가있는 다른 컨테이너가 렌더링됩니다.Reselect - 셀렉터에서 정의되지 않은 프롭
문제는 두 번째 것, 소품이 정의되지 않았고 모든 것이 깨졌습니다.
selectProductsState 정의 복귀 소품 :
여기 (소품이 2 선택기에 정의되어 있지) 코드이다.
하나 선택 :
const selectProductsState =() => ({ products }, props) => { return { products, props } };
const getCurrentProductFromParams =() => createSelector(
selectProductsState(),
getProductsItems(),
({ props }, items) => {
const id = extractId(props.params);
return items[id];
}
);
ProductContainer :
class ProductPage extends React.Component {
render() {
return (<OtherContainer />)
}
}
const mapStateToProps = createStructuredSelector({
hasLoadingErrors: getHasLoadingErrors(),
productNotFound: getProductNotFound(),
product: getProduct(),
getCurrentProductFromParams
});
또 다른 컨테이너가 자신의 선택기가 있습니다.
어떻게 해결할 수 있습니까?
감사
고마워요! 그게 효과가 있었어! –