Answers for "react hooks html imput on change"

0

react hooks html imput on change

function useInput({ type /*...*/ }) {
   const [value, setValue] = useState("");
   const input = <input value={value} onChange={e => setValue(e.target.value)} type={type} />;
   return [value, input];
 }
Posted by: Guest on August-24-2021
0

react hooks html imput on change

const [username, userInput] = useInput({ type: "text" });
 const [password, passwordInput] = useInput({ type: "text" });

 return <>
   {userInput} -> {username} <br />
   {passwordInput} -> {password}
 </>;
Posted by: Guest on August-24-2021

Browse Popular Code Answers by Language