Webコンソールで警告がでた
Warning:
value
prop oninput
should not be null. Consider using the empty string to clear the component orundefined
for uncontrolled components.
<input className="form-control"
type="text"
name="name"
value={this.state.company.name}
onChange={this.onChangeValue}
原因は上記フォームの this.state.company.name
が undefined
になっていた点
つまり、value属性に 'undefinded' を入れるなということ。
getInitialState: function() {
return {
company: {
name: ''
}
}
}
getInitialState
で初期値で ''
(空文字)を入れて、value属性に undefined
が入らないようにした。