Auto focus is not working when i passs the state and setState from the parent component but it works when it is internal to the component. export default function OTP({ setOtp, otp }) { // const [otp, setOtp] = useState('') return ( <OtpInput value={otp} onChange={setOtp} numInputs={4} inputStyle={'otp_input'} renderSeparator={<span>-</span>} renderInput={(props) => <input {...props} />} /> ) }