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编写一个应用程序,不知道如何从子元素更新父状态.先感谢您