Redux Form崩溃应用程序没有错误

时间:2016-06-06 13:40:21

标签: javascript reactjs redux material-ui redux-form

加载redux表单(来自https://github.com/erikras/redux-form-material-ui示例的代码)时,它会在控制台中没有错误地崩溃应用程序。这是表格的样子:

import {Component} from 'react'
import { reduxForm, Field } from 'redux-form'
import MenuItem from 'material-ui/MenuItem'
import { RadioButton } from 'material-ui/RadioButton'
import {
  Checkbox,
  RadioButtonGroup,
  SelectField,
  TextField,
  Toggle
} from 'redux-form-material-ui'

class MyForm extends Component {
  render() {
    return (
      <form>
        <Field name="username" component={TextField} hintText="Street"/>

        <Field name="plan" component={SelectField} hintText="Select a plan">
          <MenuItem value="monthly" primaryText="Monthly"/>
          <MenuItem value="yearly" primaryText="Yearly"/>
          <MenuItem value="lifetime" primaryText="Lifetime"/>
        </Field>

        <Field name="agreeToTerms" component={Checkbox} label="Agree to terms?"/>

        <Field name="receiveEmails" component={Toggle} label="Please spam me!"/>

        <Field name="bestFramework" component={RadioButtonGroup}>
          <RadioButton value="react" label="React"/>
          <RadioButton value="angular" label="Angular"/>
          <RadioButton value="ember" label="Ember"/>
        </Field>
      </form>
    )
  }
}

// Decorate with redux-form 
MyForm = reduxForm({
  form: 'myForm'
})(MyForm)

export default MyForm

然后我在父母中渲染这个COMP。我还在combineReducers函数中包含了“formReducer”。

0 个答案:

没有答案