-
Notifications
You must be signed in to change notification settings - Fork 0
/
temp2.tsx
39 lines (34 loc) · 1.19 KB
/
temp2.tsx
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
import React, { useEffect, useState } from "react";
import { StyleSheet, Text, View } from "react-native";
import { useAppDispatch, useAppSelector } from "./src/app/hooks";
import { fetchMachineById, increment } from "./src/app/machine";
// import { useSelector, useDispatch } from "react-redux";
// import { fetchAPI } from "./src/service/machineApi";
// import { useGetMachineQuery } from "./src/service/machineApi";
export default function App1() {
// const { data, error, isLoading, isFetching, isSuccess } =
// useGetMachineQuery();
const { info, sensorStatus } = useAppSelector((state) => state.machine);
const dispatch = useAppDispatch();
useEffect(() => {
dispatch(fetchMachineById)
console.log(123)
}, []);
return (
<View style={styles.container}>
{/* {isLoading && <Text>..loading</Text>}
{isFetching && <Text>..fetching</Text>}
{error && <Text>Something wrong</Text>}
{isSuccess && <Text>..success</Text>} */}
<Text>{info.name}</Text>
<Text onPress={() => dispatch(increment)}>Test</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
},
});