react hooks html imput on change

Solutions on MaxInterview for react hooks html imput on change by the best coders in the world

showing results for - "react hooks html imput on change"
Lisa
04 Mar 2016
1 const [username, userInput] = useInput({ type: "text" });
2 const [password, passwordInput] = useInput({ type: "text" });
3
4 return <>
5   {userInput} -> {username} <br />
6   {passwordInput} -> {password}
7 </>;
8
Victoria
15 Sep 2020
1 function useInput({ type /*...*/ }) {
2   const [value, setValue] = useState("");
3   const input = <input value={value} onChange={e => setValue(e.target.value)} type={type} />;
4   return [value, input];
5 }
6