如何替换这个mapStateToProps代码来挂钩useSelector?我以前从未使用过redux,并且很难理解它。
interface BasicProductMarksListOwnProps {
productMarks: MarkResult[];
}
interface BasicProductMarksListStore {
productMarksState: AdditionalFilterState;
}
interface BasicProductMarksListActions {
onProductMarkChange: (productMarkGroupId: GenericId, isActive: boolean) =>
() => void;
}
export type BasicProductMarksListProps = BasicProductMarksListOwnProps
& BasicProductMarksListStore & BasicProductMarksListActions;
const mapStateToProps: MapStateToProps<BasicProductMarksListStore,
BasicProductMarksListOwnProps, ApplicationState> = (state) => ({
productMarksState: productMarksGroupStateSelector(state),
});
1条答案
按热度按时间ibps3vxo1#
从您提供的代码中,我假设以下代码可以工作。
const productMarks = useSelector(state => productMarksGroupStateSelector(state))
.请确保在功能组件内执行上述代码。