React final form 反应数组中的最终表单验证消息
我正在从Mongoose发回服务器端验证,我已经将JSON操作到这个结构中,我认为最终形式是必需的:React final form 反应数组中的最终表单验证消息,react-final-form,React Final Form,我正在从Mongoose发回服务器端验证,我已经将JSON操作到这个结构中,我认为最终形式是必需的: { "persons": [ { "firstName": "Path `firstName` is required." }, { "secondName": "Path `secondName` is required." } ] } 我的值在此结构中,但当我返回错误时,仅显示第一条错误消息
{
"persons": [
{
"firstName": "Path `firstName` is required."
},
{
"secondName": "Path `secondName` is required."
}
]
}
我的值在此结构中,但当我返回错误时,仅显示第一条错误消息
validate={() => {
return this.props.validationErrors &&
this.props.validationErrors.landlord
? this.props.validationErrors.landlord
: {};
}}
如果阵列中只有一个条目,则会显示每个错误我现在看到错误,返回的错误结构需要为:
const errors = [{
firstName: 'Here is an error',
secondName: 'Here is an error'
}]
我现在看到了错误,我的错误结构应该是:
const errors = [{
firstName: 'Here is an error',
secondName: 'Here is an error'
}]