小编use*_*105的帖子

如何在react-native中传递child和parent之间的数据?

module.exports= class APP extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      key1:'key1',
      key2:'key2'
    };
  render() {
    return (
       <View>
          <Button
             onPress={this.goToTisch}>
             1
          </Button>
          <Button
             onPress={this.goToTisch}>
             2
          </Button>
       </View>
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

我只是用react-native编写一个应用程序,不知道如何从子元素更新父状态.先感谢您

javascript react-native

9
推荐指数
2
解决办法
2万
查看次数

标签 统计

javascript ×1

react-native ×1