class Input extends React.Component{
constructor(props){
super(props);
this.state = {
value: ''
};
this.putChange = this.putChange.bind(this);
}
putChange(event){
this.setState({
value: event.target.value
})
}
render(){
return (
<label>
<input type="text" placeholder={this.props.placeholder}
value={this.state.value}
onChange={() => this.putChange(event)}/>
</label>
);
}
}
A component 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:
组件正在更改类型文本的受控输入以不受控制。输入元件不应该从受控切换到未控制(反之亦然)。决定使用一个受控的或未受控的输入元件来使用组件的寿命
这是什么情况?