0
<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.

Dharman
  • 21,838
  • 18
  • 57
  • 107

5 Answers5

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

Worked for me

Muhammad Ovi
  • 852
  • 11
  • 24
5

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()} />
Dharman
  • 21,838
  • 18
  • 57
  • 107
Bernie Green
  • 77
  • 1
  • 5
1

You have to wrap input tag into form:

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

You need to use autoComplete="off". See working example.

const Element = () => (
  <div>
    <input
      name="email"
      autoComplete="off" />
  </div>
);

ReactDOM.render(
  <Element />,
  document.getElementById('root')
);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>


<div id="root"></div>
loelsonk
  • 3,186
  • 2
  • 13
  • 22
-1

It should be autocomplete="off". But keep in mind that chrome officially ignores this and will use autocomplete anyway. Take a look here for some workarounds

  • autoComplete is the React version of it, will be transformed to autocomplete on render. – mimic Jul 07 '20 at 00:05