I came across this issue a few days ago. Do you anyone knew how to disable browser autocomplete on the Input element in React.js?? I already tried :
- autoComplete="off"
- autocomplete="new-password"
Both are not working.
Thank you for your answer.
Solution from https://www.codementor.io/@leonardofaria/disabling-autofill-in-chrome-zec47xcui
What solved the issue for me is setting the form fields to read only and then removing the attribute once the user focus them.
<input readonly="readonly" onfocus="this.removeAttribute('readonly');" type="text" value="test">
The tags autoComplete="off" and autocomplete="new-password" does not work with browsers. Add this to the input tags and it will work as expected.
onFocus={(e) => e.target.setAttribute("autoComplete", "none")}
autoComplete, with uppercase C. But even then, you could have suprises.