pass named function to react.memo so in dev tools it doesn't show as anonymous (#2216)

This makes debugging easier as well
This commit is contained in:
Aakansha Doshi 2020-10-08 03:07:19 +05:30 committed by GitHub
parent 215128ffdf
commit 3835fa60e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 52 additions and 53 deletions

View File

@ -9,8 +9,7 @@ import "../css/styles.scss";
import { ExcalidrawProps } from "../types";
import { IsMobileProvider } from "../is-mobile";
const Excalidraw = React.memo(
(props: ExcalidrawProps) => {
const Excalidraw = (props: ExcalidrawProps) => {
const {
width,
height,
@ -52,8 +51,9 @@ const Excalidraw = React.memo(
</IsMobileProvider>
</InitializeApp>
);
},
(prevProps: ExcalidrawProps, nextProps: ExcalidrawProps) => {
};
const areEqual = (prevProps: ExcalidrawProps, nextProps: ExcalidrawProps) => {
const { initialData: prevInitialData, user: prevUser, ...prev } = prevProps;
const { initialData: nextInitialData, user: nextUser, ...next } = nextProps;
@ -65,7 +65,6 @@ const Excalidraw = React.memo(
prevKeys.length === nextKeys.length &&
prevKeys.every((key) => prev[key] === next[key])
);
},
);
};
export default Excalidraw;
export default React.memo(Excalidraw, areEqual);