'React Otp Input onChange not getting called on entering input
I am using react-otp-input, in a preact application. I have written the following code ,
const [otp, setOtp] = useState('');
<OtpInput
value={otp}
onChange={(value) => {
console.log(value);
setOtp(value);
}}
placeholder={'12121'}
numInputs={5}
containerStyle={'otp-container'}
inputStyle={'otp-input'}
errorStyle={'otp-error'}
hasErrored={otpError}
/>
When I am input any value from keyboard the otp is not getting updated i.e onChange is not getting called, but when I hit backspace, the onChange is getting called.
Please help me to resolve this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
