React警告提示:
warning.js:44 Warning: AddAddress is changing a controlled input of type text to be uncontrolled. Input elements should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://fb.me/react-controlled-components
Warning: <Component> is changing a uncontrolled input of type text to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://fb.me/react-controlled-components
問題分析:
React Input dom uncontrolled 導致報警告
問題解決:
Change <input {...this.props.fields.firstName}/> to <input {...this.props.fields.firstName} value={this.props.fields.firstName.value || ''}/> <input type="text" placeholder="請輸入收貨人姓名" value={form.name || '' } />
有疑問或技術交流,掃描公衆號一起討論學習。
更多React在線學習訪問:http://each.sinaapp.com/react/index.html