Javascript 表单字段的数据突然转移到另一个字段

Javascript 表单字段的数据突然转移到另一个字段,javascript,reactjs,react-bootstrap,Javascript,Reactjs,React Bootstrap,当我填写一个字段时,字母被转移到另一个字段,可以在另一个组件的文本块中转移。在那之前一切都很好,只是一会儿出了点问题,不明白。请帮忙 我的组成部分: 从“React”导入React 从“axios”导入axios 从“react bootstrap”导入{Row,Col,FormGroup,ControlLabel,FormControl,HelpBlock} 从“../../SelectizeSimple”导入SelectizeSimple 从“react redux”导入{connect}

当我填写一个字段时,字母被转移到另一个字段,可以在另一个组件的文本块中转移。在那之前一切都很好,只是一会儿出了点问题,不明白。请帮忙

我的组成部分:

从“React”导入React
从“axios”导入axios
从“react bootstrap”导入{Row,Col,FormGroup,ControlLabel,FormControl,HelpBlock}
从“../../SelectizeSimple”导入SelectizeSimple
从“react redux”导入{connect}
从“redux”导入{bindActionCreators}
进口{
setUserSecureId,
setUserName,
赛特公司,
setAddressFirstLine,
setAddressSecondLine,
塞西蒂,
设定状态,
setZip,
setVat,
设置电子邮件
}来自“存储/用户”
类PersonalInfo扩展了React.Component{
建造师(道具){
超级(道具)
此.state={
inputName:“”
}
}
submitFormPersonalInfo=(事件)=>{
轴心柱(“”{
查询:'mutation UpdateUser($form:UpdateUserInput!){update_user(input:$form){id}}',
变量:{form:this.props.updateUser},
})。然后(res=>{
console.log(res)
})
}
changeUserName=(事件)=>{
this.props.actions.setUserName(event.target.value)
}
变更公司=(事件)=>{
this.props.actions.setCompany(event.target.value)
}
changeAddressFirstLine=(事件)=>{
this.props.actions.setAddressFirstLine(event.target.value)
}
changeAddressSecondLine=(事件)=>{
this.props.actions.setAddressSecondLine(event.target.value)
}
changeCity=(事件)=>{
this.props.actions.setCity(event.target.value)
}
changeState=(事件)=>{
this.props.actions.setState(event.target.value)
}
changeZIP=(事件)=>{
this.props.actions.setZip(event.target.value)
}
changeVat=(事件)=>{
this.props.actions.setVat(event.target.value)
}
changeEmail=(事件)=>{
this.props.actions.setEmail(event.target.value)
}
render(){
返回(
个人信息
电子邮件
编辑
此地址将显示在您的许可证上。
密码
编辑
名称
公司名称(可选)
从我的个人资料中隐藏我的国家信息
地址行1
地址行2(可选)
城市
州/省/地区
邮政编码
增值税编号(如适用)
保存更改
)
}
}
常量mapStateToProps=(状态)=>{
返回({
updateUser:state.user.updateUser,
})
}
const mapDispatchToProps=(调度)=>({
操作:bindActionCreators({
setUserSecureId,
setUserName,
赛特公司,
setAddressFirstLine,
setAddressSecondLine,
塞西蒂,
设定状态,
setZip,
setVat,
设置电子邮件
},派遣),
})

导出默认连接(MapStateTrops、mapDispatchToProps)(PersonalInfo)
您的问题是因为多个redux操作ID的常量相同:

export const SET_COMPANY='SET_COMPANY'
导出常量集合地址集合第一行='集合公司'
导出常量集合地址集合第二行='集合公司'
需要替换为:

export const SET_COMPANY='SET_COMPANY'
export const SET_ADDRESS_FIRST_LINE='SET_ADDRESS_FIRST_LINE'
export const SET_ADDRESS_SECOND_LINE='SET_ADDRESS_SECOND_LINE'

有人能解释为什么表单元素会进入全局redux状态而不是内部组件状态,并在单击表单提交按钮后一起进入全局redux状态吗?