score:0

const App = () => {
  const [value, setValue] = useState("");
  const handleChange = (event) => {
    console.log(event.target.value);
    setValue(event.target.value);
  };

  const handleSubmit = (event) => {
    event.preventDefault();
    console.log(value);
  };

  return (
    <form onSubmit={handleSubmit}>
      <label>
        Name:
        <input type="text" value={value} onChange={handleChange} />
      </label>
      <input type="submit" value="Login" name="login" />
    </form>
  );
};

export default App;

Related Query

More Query from same tag