Explorar el Código

refactor DeleteCommentModal

yohei0125 hace 3 años
padre
commit
f67bd7133c

+ 9 - 9
packages/app/src/components/PageComment/DeleteCommentModal.tsx

@@ -25,7 +25,7 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
     isShown, comment, errorMessage, cancelToDelete, confirmToDelete,
     isShown, comment, errorMessage, cancelToDelete, confirmToDelete,
   } = props;
   } = props;
 
 
-  const headerContent = useMemo(() => {
+  const headerContent = () => {
     if (comment == null || isShown === false) {
     if (comment == null || isShown === false) {
       return <></>;
       return <></>;
     }
     }
@@ -35,9 +35,9 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
         Delete comment?
         Delete comment?
       </span>
       </span>
     );
     );
-  }, [comment, isShown]);
+  };
 
 
-  const bodyContent = useMemo(() => {
+  const bodyContent = () => {
     if (comment == null || isShown === false) {
     if (comment == null || isShown === false) {
       return <></>;
       return <></>;
     }
     }
@@ -59,9 +59,9 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
         <p className="card well comment-body mt-2 p-2">{commentBodyElement}</p>
         <p className="card well comment-body mt-2 p-2">{commentBodyElement}</p>
       </>
       </>
     );
     );
-  }, [comment, isShown]);
+  };
 
 
-  const footerContent = useMemo(() => {
+  const footerContent = () => {
     if (comment == null || isShown === false) {
     if (comment == null || isShown === false) {
       return <></>;
       return <></>;
     }
     }
@@ -75,18 +75,18 @@ export const DeleteCommentModal = (props: DeleteCommentModalProps): JSX.Element
         </Button>
         </Button>
       </>
       </>
     );
     );
-  }, [cancelToDelete, comment, confirmToDelete, errorMessage, isShown]);
+  };
 
 
   return (
   return (
     <Modal isOpen={isShown} toggle={cancelToDelete} className={`${styles['page-comment-delete-modal']}`}>
     <Modal isOpen={isShown} toggle={cancelToDelete} className={`${styles['page-comment-delete-modal']}`}>
       <ModalHeader tag="h4" toggle={cancelToDelete} className="bg-danger text-light">
       <ModalHeader tag="h4" toggle={cancelToDelete} className="bg-danger text-light">
-        {headerContent}
+        {headerContent()}
       </ModalHeader>
       </ModalHeader>
       <ModalBody>
       <ModalBody>
-        {bodyContent}
+        {bodyContent()}
       </ModalBody>
       </ModalBody>
       <ModalFooter>
       <ModalFooter>
-        {footerContent}
+        {footerContent()}
       </ModalFooter>
       </ModalFooter>
     </Modal>
     </Modal>
   );
   );