2016-12-30 68 views
0

我正在玩Reduce形式。我處於這種情況下,我無法在附加的輸入字段中輸入值。無論我想輸入什麼,光標仍然處於起點。無法在輸入組件中以Redux形式輸入任何內容

我的問題是一種類似於:Redux Form - Not able to type anything in input

附件是我的代碼。

Login.js:

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

class Login extends Component { 

    handleFormSubmit = (e) => { 
    //handling login data. 
    console.log('hi'); 
    console.log(e); 
}; 


render() { 
    // console.log(this.props); 
    console.log(this.props); 
    const {handleSubmit, fields:{email}} = this.props; 

    return (
     <Form onSubmit ={handleSubmit(this.handleFormSubmit.bind(this))}> 

     <fieldset className="form-group"> 
     <label>Email:</label> 
     <Field name="email" component="input" type="text"  
     className="form-control" {...email}/> 
     </fieldset> 

     <button type="submit" className="btn btn-lg btn-primary"> 
     SignIn 
    </button> 
    </Form> 
); 
} 
} 

export default reduxForm({ 
    form: 'LoginForm', 
    fields: ['email'] 
    })(Login); 

附件是我的package.json

enter image description here

附件是我的情景: enter image description here

任何幫助,將不勝感激。

+0

有沒有錯誤?而這個對象包含了什麼?{... email}'? –

回答

0

您在混合v5v6的用法。

擺脫render()方法中的email變量,您應該沒問題。

相關問題