1.构造函数中初始化需要的状态及变量:
constructor(props) {
super(props);
this.state = {
textValue: "请输入内容..."
}
}
2.在textarea改变时修改状态机变量:
在onChange函数中修改状态及变量:
this.setState({
textValue: value
});
3.状态机变量被修改后便会重新走render函数刷新界面。
1.构造函数中初始化需要的状态及变量:
constructor(props) {
super(props);
this.state = {
textValue: "请输入内容..."
}
}
2.在textarea改变时修改状态机变量:
在onChange函数中修改状态及变量:
this.setState({
textValue: value
});
3.状态机变量被修改后便会重新走render函数刷新界面。
本文标题:React native-状态机变量
本文链接:https://www.haomeiwen.com/subject/upmjtxtx.html
网友评论