react-redux 组件的元素类型无效(得到:未定义)

Element type is invalid (got: undefined) for react-redux component

我正在尝试为 redux-form 创建一个组件。这是我的组件

import React, { PropTypes } from 'react'
import Input from 'react-toolbox'

export const TextField = ({ input, meta: { touched, error }, ...custom }) => (
  <Input
    error={touched && error}
    {...input}
    {...custom}
  />
)

TextField.propTypes = {
  input: PropTypes.object,
  meta: PropTypes.object
}

export default TextField

我还创建了一个 index.js 文件以便轻松导入它

import TextField from './TextField'   
export default TextField

那我就这样用

import TextField from 'components/TextField'
import { Field } from 'redux-form'
<form onSubmit={props.handleSubmit(props.loginUser)}>
  <Field type='email' label='Email' name='email' component={TextField} required />
</form>

但是我得到这个错误

Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of TextField.

我再检查一次

尝试改变:

import Input from 'react-toolbox'

至:

import Input from 'react-toolbox/lib/input';

import {Input} from 'react-toolbox';

两者都应该有效

我认为在你的情况下 Input 是未定义的导入方式