Skip to content

Instantly share code, notes, and snippets.

@chuyihuang
Created August 13, 2017 04:32
Show Gist options
  • Save chuyihuang/3a3a6f6e54897e14bb1a558bf1b5e239 to your computer and use it in GitHub Desktop.
Save chuyihuang/3a3a6f6e54897e14bb1a558bf1b5e239 to your computer and use it in GitHub Desktop.
React Native workshop week 2 snippet
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