Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我不能用路由器和警报来撰写_Javascript_Reactjs_Redux - Fatal编程技术网

Javascript 我不能用路由器和警报来撰写

Javascript 我不能用路由器和警报来撰写,javascript,reactjs,redux,Javascript,Reactjs,Redux,我不能使用compose with Router和with Alert 这只适用于路由器,但我不能使用它。道具。警报。成功 它显示错误 未处理的拒绝(TypeError):无法读取未定义的属性“success” 从“React”导入React; 从“@material ui/core/Container”导入容器; 从“@material ui/core/Typography”导入排版; 从“@material ui/core/Grid”导入网格; 从“react router dom”导入{w

我不能使用compose with Router和with Alert 这只适用于路由器,但我不能使用它。道具。警报。成功

它显示错误 未处理的拒绝(TypeError):无法读取未定义的属性“success”
从“React”导入React;
从“@material ui/core/Container”导入容器;
从“@material ui/core/Typography”导入排版;
从“@material ui/core/Grid”导入网格;
从“react router dom”导入{withRouter};
从“@material ui/core/Paper”导入纸张;
从“@物料界面/核心/按钮”导入按钮;
从“反应警报”导入{withAlert};
从“@material ui/core/Select”导入选择;
从“@material ui/core/InputLabel”导入InputLabel;
从“@material ui/core/MenuItem”导入菜单项;
从“@material ui/core/FormControl”导入FormControl;
从“redux”导入{compose};
从“./../firebase/firebase.utils”导入{firestore}”;
类Updatestatusproperty扩展了React.Component{
建造师(道具){
超级(道具);
此.state={
id:this.props.match.params.id,
现状:1
};
}
handleSubmit=异步(事件)=>{
event.preventDefault();
此.props.alert.success(“อัพเดทสถานะบ้านเสร็จสิ้น");  
//火库
//.收藏(“房屋”)
//.doc(此.state.id)
//.update({status:this.state.status})
//.然后(()=>{
//此.props.alert.success(“อัพเดทสถานะบ้านเสร็จสิ้น");
// })
//.catch((错误)=>{
//console.log(错误)
// });
};
handleChange=(事件)=>{
this.setState({status:event.target.value});
console.log(event.target.value)
};
render(){
返回(
{"อัพเดทสถานะ"}
{"อัพเดทสถานะบ้าน"}
อัพเดทสถานะบ้าน
พร้อมขาย
อยู่ระหว่างเจรจา
ขายออกไปแล้ว
อัพเดทสถานะ
);
}
}

导出默认组合(withRouter(Updatestatusproperty),withAlert());
您使用的组合函数不正确

您需要将HOCs作为参数传递给它,而不需要像下面那样调用它

export default compose(withRouter,withAlert())(Updatestatusproperty);

您不正确地使用了compose函数

您需要将HOCs作为参数传递给它,而不需要像下面那样调用它

export default compose(withRouter,withAlert())(Updatestatusproperty);

我更改它并显示error×error:对象作为React子对象无效(找到:具有键{$$typeof,render}的对象)。如果要呈现子级集合,请改用数组。我更新了我的答案,需要调用withAlert,因为它返回一个函数,然后将组件作为参数接收。我更新了我的答案,需要调用withAlert,因为它返回一个函数,然后将组件作为参数接收。我更改它并显示error×错误:对象作为React子对象无效(找到:具有键{$$typeof,render}的对象)。如果要呈现子集合,请改用数组。我更新了我的答案,需要调用withAlert,因为它返回一个函数,然后将组件作为参数接收。我更新了我的答案,需要调用withAlert,因为它返回一个函数,然后将组件作为参数接收