使用this.refs无法获取input类型的值...如何从输入类型中获取那些值
export class BusinessDetailsForm extends Component {
submitForm(data) {
console.log(this.refs.googleInput.value)
}
}
reder() {
return(
<form onSubmit={this.submitForm}>
<Field type="text"
name="location"
component={GoogleAutoComplete}
id="addressSearchBoxField"
ref="googleInput"
/>
</form>
)
}
}
ref
来获取输入框的值,而这个答案提供了解决方案以满足这个需求。 - Danthis.googleInput.current.value
。 - Phil