Просмотр исходного кода

use memo component in ReactMarkdown

reiji-h 1 год назад
Родитель
Сommit
3bd967296b

+ 2 - 3
apps/app/src/client/components/ReactMarkdownComponents/TableWithEditButton.tsx

@@ -23,8 +23,7 @@ type TableWithEditButtonProps = {
   className?: string
 }
 
-export const TableWithEditButton = (props: TableWithEditButtonProps): JSX.Element => {
-
+export const TableWithEditButton = React.memo((props: TableWithEditButtonProps): JSX.Element => {
   const { children, node, className } = props;
 
   const { data: isGuestUser } = useIsGuestUser();
@@ -61,5 +60,5 @@ export const TableWithEditButton = (props: TableWithEditButtonProps): JSX.Elemen
       </table>
     </div>
   );
-};
+}) as typeof TableWithEditButton;
 TableWithEditButton.displayName = 'TableWithEditButton';

+ 4 - 3
packages/presentation/src/client/components/RichSlideSection.tsx

@@ -1,4 +1,5 @@
-import React, { ReactNode } from 'react';
+import type { ReactNode } from 'react';
+import React from 'react';
 
 type RichSlideSectionProps = {
   children: ReactNode,
@@ -29,7 +30,7 @@ export const RichSlideSection = React.memo((props: RichSlideSectionProps): JSX.E
       {children}
     </OriginalRichSlideSection>
   );
-});
+}) as typeof RichSlideSection;
 
 
 export const PresentationRichSlideSection = React.memo((props: RichSlideSectionProps): JSX.Element => {
@@ -40,4 +41,4 @@ export const PresentationRichSlideSection = React.memo((props: RichSlideSectionP
       {children}
     </OriginalRichSlideSection>
   );
-});
+}) as typeof PresentationRichSlideSection;