浏览代码

Eliminated some redundant functions

luislopez66 2 年前
父节点
当前提交
8b6639be96
共有 1 个文件被更改,包括 6 次插入28 次删除
  1. 6
    28
      MocionesIUPI/screens/MocionScreen.js

+ 6
- 28
MocionesIUPI/screens/MocionScreen.js 查看文件

@@ -28,48 +28,26 @@ export default App = () => {
28 28
     }
29 29
   }
30 30
 
31
-  function getVotoFavorNums() {
31
+  function getVotosNums() {
32 32
     const [countFavor, setCountFavor] = useState(0);
33
+    const [countContra, setCountContra] = useState(0);
34
+    const [countAbstenid, setCountAbstenid] = useState(0);
33 35
 
34 36
     return (
35 37
       <div>
36 38
         <button onClick={() => setCountFavor(countFavor + 1)}>
37
-        A favor
39
+          A favor
38 40
         </button>
39
-      </div>
40
-    );
41
-  }
42
-
43
-  function getVotoContraNums() {
44
-    const [countContra, setCountContra] = useState(0);
45
-
46
-    return (
47
-      <div>
48 41
         <button onClick={() => setCountContra(countContra + 1)}>
49
-        En contra
42
+          En contra
50 43
         </button>
51
-      </div>
52
-    );
53
-  }
54
-
55
-  function getVotoAbstenidNums() {
56
-    const [countAbstenid, setCountAbstenid] = useState(0);
57
-
58
-    return (
59
-      <div>
60 44
         <button onClick={() => setCountAbstenid(countAbstenid + 1)}>
61
-        Abstenida/o
45
+          Abstenido
62 46
         </button>
63 47
       </div>
64 48
     );
65 49
   }
66 50
 
67
-  function getVotoNums() {
68
-    getVotoFavorNums();
69
-    getVotoContraNums();
70
-    getVotoAbstenidNums();
71
-  }
72
-
73 51
   const getVotos = async () => {
74 52
     try {
75 53
       const response = await fetch('http://10.190.1.140:5000/send?PIN=121071'); // connection to the website