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:
parent
215128ffdf
commit
3835fa60e4
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user