我是新的反應,並試圖從handleSubmit的firstName輸入中獲取值。 handleSubmit正在工作,但由於某種原因輸入值未定義。我嘗試了其他一些例子,但它們都是React組件中的所有表單。reactjs容器組件的表格值
let SomeForm = (props) => {
let firstName = '';
const handleSubmit = (e) => {
e.preventDefault();
console.log(firstName);
}
return (
<div>
<form onSubmit={handleSubmit}>
<TextField
floatingLabelText="First Name"
floatingLabelFixed={true}
underlineStyle={styles.underlineStyle}
underlineFocusStyle={styles.underlineFocusStyle}
value={firstName}
/>
<input type="submit" value="Submit" />
</form>
</div>
)
}
SomeForm = connect()(SomeForm)
export default SomeForm
哪裏文本字段的?而且看起來你根本沒有更新你的firstName – CodinCat
TextField只是來自Material UI,那你的意思是? – user1572796