Turn off Autocomplete for Input in React

To disable autocomplete for a specific input field, we need to set autoComplete attribute to off. Example:

import React from "react";

export default function App() {
  return (
    <div theClassName="App">
      <input type="text" autoComplete="off"/>
    </div>
  );
}

To disable autocomplete for an entire form, we need to set autoComplete attribute with off value in the form like this:

import React from "react";

export default function App() {
  return (
    <div theClassName="App">
      <form autoComplete="off">
         <input type="text"/>
      </form>
    </div>
  );
}

Leave a comment

Your email address will not be published. Required fields are marked *