Reactjs AutoComplete : 'off'

Viewed 21838
<div className={inputContainerClass}>
 <input
                    required
                    autoComplete='off'
                    value={value}
                    type='password'
                    maxLength=15
                />

</div>

autoComplete : 'off', autoComplete: {'off'}, autocomplete:{false}, <input type="password" style="display:none"> are not working.

6 Answers
<input name="my-field-name" autoComplete="new-password" />

Worked for me

It seems autoComplete="off" or autoComplete="new-password" works, but after the form is used multiple times it starts saving the values of the field to whatever string you set for the autoComplete.

I've tried numerous strings for the autoComplete, but it always ends up coming back. The best solution I have found for this is to generate a new string for the autoComplete every time. I have been doing that like so with no issues:

<input name="field-name" autoComplete={'' + Math.random()} />

You have to wrap input tag into form:

<form autocomplete="off">
  <input type="text" />
</form>

Add this attribute to your component:

autoComplete="off" role="presentation"

Related