Лезет ошибка как исправить?
Warning: Input is changing an 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
import React from 'react';
import createReactClass from 'create-react-class';
var Input = createReactClass({
getDefaultProps() {
return {
classNames: 'input',
value: '',
onChange: function (event) {
console.log(event, "don't set onChange");
}
};
},
getInitialState() {
return {
title: this.props.title,
};
},
handleChange(event) {
this.props.onChange(event);
this.setState({value: event.target.value});
},
render() {
return <div className={this.props.classNames}>
<label>
{this.state.title}
<input type="text" value={this.state.value} onChange={this.handleChange} />
</label>
</div>;
}
});
export {Input};