Created
August 13, 2017 04:32
-
-
Save chuyihuang/3a3a6f6e54897e14bb1a558bf1b5e239 to your computer and use it in GitHub Desktop.
React Native workshop week 2 snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Text, View } from 'react-native'; | |
export default class App extends Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
factor1: 2, | |
factor2: 5, | |
} | |
} | |
render() { | |
return ( | |
<View style={{height: '100%', justifyContent: 'center', alignItems: 'center'}}> | |
<Text>因數1是{this.state.factor1}</Text> | |
<Text>因數2是{this.state.factor2}</Text> | |
<Text>相乘之後是{ this.state.factor1 * this.state.factor2 }</Text> | |
</View> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment