Answers for "single input value"

0

single input value

const LogIn = () => {
  const [data, setData] = useState({
    username: "usename",
    password: "password",
  });
  const handleValues = (e) => {
    console.log(e.target.value);
    const values = e.target.value;
    const name = e.target.name;
    setData({ ...data, [name]: values });
    console.log(data);
  };
  return (
        <TextField
          style={{ width: "100%" }}
          id="standard-basic"
          name="username"
          label="Username"
          onChange={handleValues}
        />
        <TextField
          onChange={handleValues}
          style={{ width: "100%" }}
          id="standard-basic"
          name="password"
          label="Password"
          type="password"
        />
  );
};
Posted by: Guest on March-13-2022

Code answers related to "single input value"

Browse Popular Code Answers by Language