TypeError: Cannot read property 'getFieldDecorator' of undefined

TypeError: Cannot read property 'getFieldDecorator' of undefined

我正在尝试按照 Ant 设计文档提供的步骤进行操作,但出现错误:

TypeError: Cannot read property 'getFieldDecorator' of undefined

import React, { Component } from 'react'
import ReactDom from 'react-dom'
import { Icon, Input, Form} from 'antd'

//
import Header from './layout/Header'

// Import Css
import '../css/Home.css'

class Home extends Component {
    render() {
    const { getFieldDecorator } = this.props.form
    return (
      <div>
        <Form>
        {getFieldDecorator('userName', {
          rules: [{ required: true, message: 'Please input your username!' }],
        })(
          <Input prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />} placeholder="Username" />
        )}
        </Form>
      </div>
    )
  }
}

const WrappedLogin = Form.create()(Home)
ReactDom.render(<WrappedLogin/>, document.getElementById('root'))

export default Home

我错过了什么吗?

仅供参考

antd: 3.1.0 反应:16.2.0 反应-dom: 16.2.0

Remark

console.log(this.props.form) // ** return getFieldDecorator: f()

也许你在其他模块使用 Home

尝试:

export default WrappedLogin => export default WrappedLogin

在我的例子中,它可以将导出的标识匹配到 const

export default WrappedLogin