Skip to content

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

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} />}
/>
)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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