小编Bec*_*oth的帖子

在React js中使用redux表单时出现字段错误

我试图在react js中做一些表单验证,而使用redux表单面临一个错误字段必须在用reduxForm()修饰的组件内.我刚刚在网上搜索了这个错误,但没有得到任何解决方案.参考链接:http://redux-form.com/6.8.0/examples/simple/.这是我的代码,

import React, { Component } from 'react';
import { Field, reduxForm } from 'redux-form';

export class EditProfile extends Component {
  render() {
    console.log("hello welcome");
    const { handleSubmit, pristine, reset, submitting } = this.props;
    return (
      <form onSubmit={handleSubmit}>
        <div>
          <label htmlFor="firstName">First Name</label>
          <Field name="firstName" component="input" type="text"/>
        </div>
      </form>
    );
  }
}


export default reduxForm({
  form: 'editForm' 
})(EditProfile)
Run Code Online (Sandbox Code Playgroud)

我在代码中做错了,有人可以澄清我.

reactjs redux redux-form

5
推荐指数
1
解决办法
9262
查看次数

标签 统计

reactjs ×1

redux ×1

redux-form ×1