나는 다음과 같은 인터페이스가 있습니다액세스 용기 소품
interface EditUserContainerProps
extends RouteComponentProps<EditUserParams>,
EditUserStateProps,
EditUserDispatchProps { }
interface EditUserParams {
id: number;
history: any;
}
interface EditUserStateProps {
isLoading: boolean;
isSubmitting: boolean;
userFields: UserField[];
User: User;
}
interface EditUserDispatchProps {
load: (id: number) => void;
updateUser: (User: User) => any;
parseFile: (file: File, replace: boolean) => any;
addRecords: (records: any[]) => any;
}
그리고 나는 mapDispatchToProps
기능은 다음과 같습니다, ownProps
는에 을 통과 소품 parseFile
에 대한 콜백에서
입니다 내 컨테이너. 나는 소품addRecords
을 포함하는 컨테이너의 에 액세스해야합니다.
어떻게 mapDispatchToProps
컨테이너 소품에 액세스 할 수 있습니다?
나는 당신이 당신이 그것을 사용하는 ownProps에 액세스 할 수 있습니다, 당신이 요구하는 것을 이해하지 않습니다. 컨테이너의 소품은 뭐지? 그냥 소유물이 아니야? – Dakota
구성 요소 계층 구조가 어떻게 보이는지 보여 줄 수 있습니까? 즉,'render' 함수는 무엇입니까? –
언급 @Dakota으로,'내 컨테이너로 전달에만 소품 (내 경우에는 없음) ownProps' 있습니다. 내 컨테이너가 생성하고 매핑 한 소품을 원합니다. – im1dermike