Skip to content

Autofocus not working when state and setState is passed from the parent #441

@YashChauhan858

Description

@YashChauhan858

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={-}
renderInput={(props) => <input {...props} />}
/>
)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions