Feat(Call): useCall hook

This commit is contained in:
chip committed 2020-09-19 01:19:03 +02:00
1 parent efbdff0849
commit fd09a2df14
11 files changed
+117 -72

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
import { atom } from "recoil";
export const callerState = {
caller: atom({
key: "callerList",
default: [],
}),
};
+7
View File
@@ -0,0 +1,7 @@
import { useRecoilValue } from "recoil";
import { callerState } from "./state";
export const useCall = () => {
const caller = useRecoilState(callerState.caller);
return { caller };
};
+10
View File
@@ -0,0 +1,10 @@
import { useNuiEvent } from "../../os/nui-events/hooks/useNuiEvent";
import { useSetRecoilState } from "recoil";
import { callerState } from "./state";
import { useCall } from "./useCall";
export const useCallService = () => {
const setCaller = useSetRecoilState(callerState.caller);
useNuiEvent("CALL", "setCaller", setCaller);
return useCall();
};