【发布时间】:2019-11-26 13:02:59
【问题描述】:
我有一个祖父容器,其中有子组件,其中还有另外两个子组件。
这两个子组件是 redux 表单。
现在我想通过表单验证处理这两个表单提交事件并执行不同的任务。如何使用 redux-forms 实现?
我尝试使用自定义道具,但 不 激活 表单验证。
这是我的代码:
父容器:
const props = {
onSubmit: this.confirmChangeBillingInformation,
}
return <CompanyDetails {...props} />;
子组件:
const CompanyDetails = (props) => {
<ChangePaymentInformation {...props} />
<ChangeCompanyPricing {...props} />
}
grand child forms:有两种这样的形式
const ChangeCompanyPricing = ({ classes, companyPricing, showChangePricingModal, actions, handleSubmit }) => {
return (
...
<form onSubmit={handleSubmit}>
<Button color="primary" type="submit" variant="raised">
Save
</Button>
...
)
}
【问题讨论】:
-
你为什么不能试试子裁判?
-
@hrudaykumarreddy 我很陌生。你能帮忙吗?
标签: javascript reactjs react-redux redux-form