Search code examples
reactjsantd

when to use array as validateTrigger in antd form?


in antd Form component there is validateTrigger property that can get a string or array of strings as value.when and why we should use array of strings?

antd form api


Solution

  • In validateTrigger property you can add string like

    validateTrigger="onBlur"

    or array of string with various input events like

    validateTrigger={["onBlur", "onFocus", "onInput"]}

    Example: https://codesandbox.io/s/registration-antd-4-24-2-forked-jon6u7

    If you want to add multiple input events then you can add it with string array in validateTrigger.