第6.2章:设置属性

2019-03-31  本文已影响0人  赵羽珩
image.png
export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      name: '456789',
    }
  }
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.title} onPress={() => this.setState({name: 'abcdefg'})}>
            {this.state.name}
        </Text>
      </View>
    );
  }
}
image.png
上一篇 下一篇

猜你喜欢

热点阅读