📜  功能组件状态管理 - Javascript 代码示例

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

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

function Submit() {

    const [inputField , setInputField] = useState({
        first_name: '',
        last_name: '',
        gmail: ''
    })

    const inputsHandler = (e) =>{
        setInputField( {[e.target.name]: e.target.value} )
    }

    const submitButton = () =>{
        alert(inputField.first_name)
    }

    return (
        



) } export default Submit