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]; }
Source: stackoverflow.com
react hooks html imput on change
const [username, userInput] = useInput({ type: "text" }); const [password, passwordInput] = useInput({ type: "text" }); return <> {userInput} -> {username} <br /> {passwordInput} -> {password} </>;
Source: stackoverflow.com