我知道这个问题是重复的,但就我而言,我找不到解决方案。我有一个对象。我正在使用一个选择器从我的状态中选择这个对象:
2017
我现在从我的mapStateToProps函数中将它作为道具:
PermissionError: [WinError 5] Access is denied: 'e:\\work\\anaconda\\lib\\site-packages\\pil\\_imaging.cp36-win_amd64.pyd'
然后在我的组件中:export const customerDetailsState = (state, selectedCustomer) => {
if (customerState(state).getIn([CUSTOMER_SESSION, 'details'])) {
return customerState(state).getIn([CUSTOMER_SESSION, 'details', selectedCustomer]);
}
return {};
};
此错误不断显示:
对象无效作为React子对象(找到:带键的对象) {lastName,firstName,identificationType,identificationCode,taxId, streetName,streetNumber,city,commercialName,state,postalCode, countryCode,country
我的组件是:
export const mapStateToProps = (state) => {
const selectedCustomer = selectedCustomerState(state);
return {
customerDetails: customerDetailsState(state, selectedCustomer)
};
};
我想把它作为道具传递!!没有这个错误怎么传递它?请不要将其标记为重复。谢谢!
答案 0 :(得分:0)
因为你的功能没有返回任何东西。返回jsx,问题就解决了。
const CustomerDetails = ({ customerDetails }) => (return(
<Card>
<CardTitle title="Πληροφορίες Πελάτη" />
<CardHeader
title="Δεδομένα Altamira"
showExpandableButton
/>
<CardText expandable>
<div>
<TextField
value={customerDetails.commercialName}
floatingLabelText={CUSTOMER_DETAILS_COMMERCIAL}
/><br />
<TextField
value={customerDetails.lastName}
floatingLabelText={CUSTOMER_DETAILS_LASTNAME}
/><br />
<TextField
value={customerDetails.firstName}
floatingLabelText={CUSTOMER_DETAILS_NAME}
/><br />
</CardText>
</Card>);
);
render(){ return(this.CustomerDetails(customerDetails))};