DefinitelyTyped/types/react-otp-input/react-otp-input-tests.tsx
Anup Bhatkhande 537d3c1655
Add Types for package react-otp-input (#47108)
* Add Types for package react-otp-input

* ReactOTPInput -New line added and extra lines removed

* Add react-otp-input to package.json

* Add react-otp-input test import modified

* Change in export OTPInput

* Change in import OTPInput

* Remove path from tsconfig.json

* Change types for style props

* Remove minor version from top definitions

* Revert package.json
2020-08-30 04:56:54 -04:00

36 lines
692 B
TypeScript

import * as React from "react";
import OTPInput from "react-otp-input";
interface InputOtpProps {
inputCount: number;
}
interface OtpInputState {
otp: number;
}
class OtpInputPage extends React.Component<InputOtpProps, OtpInputState> {
state = {
otp: 123456
};
handleChange = (otp: number) => {
this.setState({ otp });
}
render() {
const { otp } = this.state;
return (
<>
<OTPInput
value={otp}
onChange={this.handleChange}
numInputs={6}
separator={<span>-</span>}
/>
</>
);
}
}