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]>
This commit is contained in:
J Francisco RaderandTaso authored and GitHub committed 2021-04-13 21:33:18 -04:00
1 parent 4fceb3750b
commit 8dc59c47bd
7 files changed
+51 -35

No files matched your search

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