We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 51a1e07 commit ca6df6aCopy full SHA for ca6df6a
solutions/react-native-simple-counter.js
@@ -0,0 +1,32 @@
1
+import React, { useState } from "react"
2
+import { Text, View, StyleSheet } from "react-native"
3
+
4
+const SimpleCounter = () => {
5
+ const [count, setCount] = useState(0)
6
7
+ const increment = () => setCount(count + 1)
8
+ return (
9
+ <View style={styles.container}>
10
+ <Text style={styles.counter}>
11
+ button count: <span id="actualCount">{count}</span>
12
+ </Text>
13
+ <button id="mainButton" onClick={increment}>
14
+ INCREASE
15
+ </button>
16
+ </View>
17
+ )
18
+}
19
20
+const styles = StyleSheet.create({
21
+ container: {
22
+ flex: 1,
23
+ justifyContent: "center",
24
+ marginHorizontal: 10,
25
+ },
26
+ counter: {
27
+ textAlign: "center",
28
+ marginVertical: 10,
29
30
+})
31
32
+export default SimpleCounter
0 commit comments