📌  相关文章
📜  在更改时对输入值设置状态做出反应 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:22.549000             🧑  作者: Mango

代码示例1
// Get all input value by onKeyUp event using one function
const [student, setStudent] = useState({});
const setStudentValue = (e) => {
        let set = {};
        set[e.target.name] = _.trim(e.target.value);
        setStudent({
            ...student,
            ...set
        });
    }
// 

// set data
// {firstName: ""} - output