Files
new-phone-who-dis/phone/src/os/apps/components/AppWithStartup.tsx
T
J Francisco RaderandTaso 8dc59c47bd fix(phone): Fix subsequent rerenders & added WDYR (#209)
Fixed an issue with infinite rerendering on app routes by making it a Pure component.

Adds `why-did-you-render` for development use.

Co-authored-by: Taso <[email protected]>
2021-04-13 21:33:18 -04:00

15 lines
340 B
TypeScript

import { memo, useEffect } from 'react';
import { useNuiRequest } from 'fivem-nui-react-lib';
const Component = ({ children, id }) => {
const Nui = useNuiRequest();
useEffect(() => {
Nui.send(`npwd:app:${id}`);
}, [Nui, id]);
return children;
};
const AppWithStartup = memo(Component, () => true);
export { AppWithStartup };