【发布时间】:2019-07-11 10:03:32
【问题描述】:
你能告诉我为什么页面刷新按钮点击反应?我在输入字段中输入内容并按下按钮,我的页面被刷新 我想获取表单域的值 https://codesandbox.io/s/green-frost-414qi
class ContactForm extends React.Component {
handleSubmit = values => {
// print the form values to the console
console.log(values);
};
render() {
return (
<form onSubmit={this.handleSubmit}>
<div>
<label htmlFor="firstName">First Name</label>
<Field name="firstName" component="input" type="text" />
</div>
<button type="submit">Submit</button>
</form>
);
}
}
const ContactRForm = reduxForm({
// a unique name for the form
form: "contact"
})(ContactForm);
export default ContactRForm;
【问题讨论】:
标签: reactjs redux react-redux redux-form