📅  最后修改于: 2022-03-11 15:03:06.952000             🧑  作者: Mango
function useInput({ type /*...*/ }) {
const [value, setValue] = useState("");
const input = setValue(e.target.value)} type={type} />;
return [value, input];
}
const [username, userInput] = useInput({ type: "text" });
const [password, passwordInput] = useInput({ type: "text" });
return <>
{userInput} -> {username}
{passwordInput} -> {password}
>;