-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
28 lines (21 loc) · 813 Bytes
/
App.js
File metadata and controls
28 lines (21 loc) · 813 Bytes
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
import React, { useState, useCallback } from 'react';
import { Text, View, Button } from 'react-native';
const App = () => {
const [count, setCount] = useState(0);
const handleIncrement = useCallback(() => {
setCount(current => current + 1);
}, []);
const handleDecrement = useCallback(() => {
setCount(current => current - 1);
}, []);
return (
<View style={{flex:1, alignItems:"center", justifyContent:"center", backgroundColor:"#FFEBC1"}}>
<Text style={{fontSize:30}}>Counter App{'\n'}</Text>
<Text style={{fontSize:20}}>Counter: {count} {'\n'}</Text>
<Button color="#A64B2A" title="Increment" onPress={handleIncrement}/>
<Text>{'\n'}</Text>
<Button color="#D7A86E" title="Decrement" onPress={handleDecrement}/>
</View>
);
}
export default App;