簡體   English   中英

redux-form 如何顯示異步驗證成功

[英]redux-form how to show async validation success

我有一個帶有redux-form和異步驗證功能的更改密碼表單。

如何判斷異步驗證何時成功完成?

我正在嘗試從 props 獲取字段數據,但我得到了undefined

怎么做到呢?

function ChangePassword(props) {
  console.log(props);

  return (
    <div className="general-information-container ">
      <form className="relative general-information-form change-password-container">
        <div className="field-header">Genreal information</div>
        <Field
          name="currentPassword"
          component={renderField}
          type="password"
          placeholder="Enter you current password"
          label="Current Password"
        />
        <Field
          name="newPassword"
          component={renderField}
          type="password"
          label="New Password"
          placeholder="Enter New Password"
        />
        <Field
          name="confirmNewPassword"
          component={renderField}
          type="password"
          label="Confirm Password"
          placeholder="Confirm Password"
        />
        <button type="submit" className="edit-values">
          Change Password
        </button>
      </form>
    </div>
  );
}

export default reduxForm({
  form: "changePassword",
  asyncValidate: passwordAsyncValidate,
  asyncBlurFields: ["currentPassword"],

})(ChangePassword); 

謝謝🙏

這是來自 redux-form 文檔的一個很好的例子。

https://codesandbox.io/s/nKlYo387

希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM