📌  相关文章
📜  使用钩子获取输入值 - Javascript代码示例

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

代码示例1
import React, {useState} from 'react'

export default () => {
    const [fName, setfName] = useState('');
    const [lName, setlName] = useState('');
    const [phone, setPhone] = useState('');
    const [email, setEmail] = useState('');

const submitValue = () => {
    const frmdetails = {
        'First Name' : fName,
        'Last Name' : lName,
        'Phone' : phone,
        'Email' : email
    }
    console.log(frmdetails);
}

return(
    <>
    
setfName(e.target.value)} /> setlName(e.target.value)} /> setPhone(e.target.value)} /> setEmail(e.target.value)} /> ) }