mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
feat(utils/nui): able to merge data
This commit is contained in:
1 parent
d3a2ee7628
commit
804c8da9cb
1 file changed
+4
-2
@@ -20,7 +20,8 @@ export const useNuiEvent = (
|
|||||||
app: string,
|
app: string,
|
||||||
method: string,
|
method: string,
|
||||||
handler: Function,
|
handler: Function,
|
||||||
options: IOptions = {}
|
options: IOptions = {},
|
||||||
|
currentState?: Record<string, unknown>
|
||||||
) => {
|
) => {
|
||||||
const savedHandler: MutableRefObject<any> = useRef();
|
const savedHandler: MutableRefObject<any> = useRef();
|
||||||
// Destructure passed options
|
// Destructure passed options
|
||||||
@@ -42,7 +43,8 @@ export const useNuiEvent = (
|
|||||||
data: event.data,
|
data: event.data,
|
||||||
level: 1,
|
level: 1,
|
||||||
});
|
});
|
||||||
savedHandler.current(data);
|
const newData = currentState ? { ...currentState, ...data } : data
|
||||||
|
savedHandler.current(newData)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Why are destructing then restructuring option data?
|
// Why are destructing then restructuring option data?
|
||||||
|
|||||||
Reference in new issue
Block a user