mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 14:38:45 +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,
|
||||
method: string,
|
||||
handler: Function,
|
||||
options: IOptions = {}
|
||||
options: IOptions = {},
|
||||
currentState?: Record<string, unknown>
|
||||
) => {
|
||||
const savedHandler: MutableRefObject<any> = useRef();
|
||||
// Destructure passed options
|
||||
@@ -42,7 +43,8 @@ export const useNuiEvent = (
|
||||
data: event.data,
|
||||
level: 1,
|
||||
});
|
||||
savedHandler.current(data);
|
||||
const newData = currentState ? { ...currentState, ...data } : data
|
||||
savedHandler.current(newData)
|
||||
}
|
||||
};
|
||||
// Why are destructing then restructuring option data?
|
||||
|
||||
Reference in new issue
Block a user