[英]Altering react form but input value not editable
我来自angularjs背景,使用2种方式绑定,我不必担心,只需声明一个Submit函数,就可以获取更改或未更改的值。
我现在反应迟钝。 我的输入不可编辑。
class HelloWorldComponent extends React.Component {
constructor(){
super();
this.handleChange = this.handleChange.bind(this)
}
render() {
const person = {"name":"james"};
return (
<input onChange={this.handleChange} type="text" placeholder="name" value={person.name} />
);
}
handleChange(e){
}
}
React.render(
<HelloWorldComponent />, document.getElementById('react_example')
);
http://jsbin.com/huluqifanu/1/edit?js,控制台,输出
还有下一步该怎么办? 我应该先将api数据设置为状态吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.