[英]Need Help Pinpointing this warning - Warning: setState(…): Cannot update during an existing state transition
I am using redux-form and react-redux. 我正在使用redux-form和react-redux。
This is the warning I am getting. 这是我得到的警告。
You will notice that is points to 3 places in my code CreateNewOrderForm.jsx:39, NewOrderFormFour.jsx:65, and NewOrderFormFour.jsx:122. 您会注意到,这指向我的代码CreateNewOrderForm.jsx:39,NewOrderFormFour.jsx:65和NewOrderFormFour.jsx:122中的3个位置。
I need another pair eyes to look at it. 我需要另一双眼睛看它。
CreateNewOrderForm.jsx:39: CreateNewOrderForm.jsx:39:
toggleDialog = (id) => {
const { dialog, openDialogFunction, closeDialogFunction } = this.props;
if (dialog.show && (dialog.id === 'confirmOrderDialog' || 'confirmOrderDialog')) {
closeDialogFunction(id);
}
else {
openDialogFunction(id, 1);
}
}
NewOrderFormFour.jsx:65: NewOrderFormFour.jsx:65:
openConfirmationDialog = () => {
const { openDialogFunction } = this.props;
openDialogFunction('confirmOrderDialog');
}
NewOrderFormFour.jsx:122: NewOrderFormFour.jsx:122:
<Form
id="createOrder"
onSubmit={ handleSubmit(this.openConfirmationDialog()) }
>
Do I need to call the this.openConfirmationDialog
method in the handleSubmit? 我是否需要在
this.openConfirmationDialog
中调用this.openConfirmationDialog
方法?
Or put it in a callback? 还是放在回调中?
Struggled to pinpoint the error since i get over 1000 of them. 努力找出错误,因为我获得了1000多个错误。
What could i change to get this to work? 我要改变什么才能使其正常工作?
I think you need to use arrow funcion in submit onSubmit={() => handleSubmit(this.openConfirmationDialog()) }
. 我认为您需要在
onSubmit={() => handleSubmit(this.openConfirmationDialog()) }
使用箭头功能。 In your variant you call this function when component rendering. 在您的变体中,在渲染组件时调用此函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.