Skip to content

Instantly share code, notes, and snippets.

View TEJA2312's full-sized avatar
💻
It all starts with a vision

Tejas Shirnalkar TEJA2312

💻
It all starts with a vision
View GitHub Profile
import React, { useState } from 'react';
import WrongIcon from '../icons/wrongIcon';
import CorrectIcon from '../icons/correctIcons';
const PasswordInputWithValidation = () => {
const [password, setPassword] = useState('');
const [errors, setErrors] = useState({
minValueValidation: false,
numberValidation: false,
capitalLetterValidation: false,
@TEJA2312
TEJA2312 / otpInputWithValidation.jsx
Last active January 11, 2024 12:19
OTP Input Field With Validation in React Js
import React, { useRef, useEffect, useState } from 'react';
const correctOTP = "123456" // validate from your server
function OtpInputWithValidation({ numberOfDigits }) {
const [otp, setOtp] = useState(new Array(numberOfDigits).fill(""));
const [otpError, setOtpError] = useState(null);
const otpBoxReference = useRef([]);
function handleChange(value, index) {