-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
45 lines (39 loc) · 846 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import Head from './Head';
import Essence from './Essence';
import Control from './Control';
class App extends React.Component {
constructor(){
super();
this.state = {
number: 1
}
}
increase = () => {
this.setState({
number: this.state.number + 1
})
}
takeAway = () => {
this.setState({
number: this.state.number - 1
})
}
render() {
return (
<View style={styles.container}>
<Head title="Counter"/>
<Essence numerator={ this.state.number } />
<Control increase={ this.increase } takeAway={ this.takeAway } />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
});
export default App;