0
尝试了我的第一次反应,但卡住了,想要做多重绑定。状态未定义错误使用setState
class HelloWorldComponent extends React.Component {
constructor(props){
super(props);
this.state = {
price
}
}
render() {
return (
<div>
<input type="text" onChange={e => this.setState({price: e.target.value})} placeholder="main price"/>
<input type="text" placeholder="custom price"/>
</div>
);
}
}
我上面的代码有什么问题?价格没有定义?我已经声明
this.state = {
price
}
正确。我也在检查一样。我的答案在这里是错误的。 – Ved