Home > Enterprise >  Clear input value for react-pin-input upon clicking on submit button
Clear input value for react-pin-input upon clicking on submit button

Time:10-31

I am working on an OTP page, and was trying if there is a way to clear input value for react-pin-input after user clicks on the submit OTP button.

<PinInput
  ref={pintInputRef}
  length={6}
  secret
  type="numeric"
  inputMode="numeric"
  onComplete={(value) => {
    handleOnCompleteInput(value);
  }}
  autoSelect={true}
  regexCriteria={/^[ A-Za-z0-9_@./#& -]*$/}
/>

<Button
  type="primary"
  size="large"
  block
  htmlType="submit"
  onClick={handleSubmit}
> Verify </Button>

const handleSubmit = () => {
  // SET PIN INPUT TO EMPTY
}

I have tried useRef and set ref.current.value = "" but it does not work.

Edit great-currying-qgx1l6

  • Related