1. Click the event operation

<Input placeholder="Please enter user name"
                  value={this.state.form.username}
                  onChange={(e) = > this.handdleChange(e, "username")}
                  allowClear={true}
                />


  handdleChange = (e, name) = >{==>es can be obtainedthisThe value of the objectconsole.log(name);
   // this.state.form[name] = e.target.value;
    let data = this.state.form;
    data[name] = e.target.value;
    this.setState({
      form:data
    })
  }

Copy the code

How to change the value of deep state

Such asthis.state = {
	type:' '.form: {name:' '.age:' '
        }
  }

  handdleChange = (e, name) = >{==>es can be obtainedthisThe value of the objectconsole.log(name);
    let data = this.state.form;
    data[name] = e.target.value;
    this.setState({
      form:data
    })
  }
Copy the code