refactor: memoize buttons on export

This commit is contained in:
rusconn
2023-06-24 13:58:57 +09:00
parent 240fba0e74
commit 822a8db8f9
13 changed files with 103 additions and 188 deletions

View File

@@ -1,4 +1,5 @@
import { useCallback, useRef } from "react";
import { memo, useCallback, useRef } from "react";
import equal from "react-fast-compare";
import { icons } from "@/components/icons";
@@ -12,7 +13,7 @@ export type FileButtonProps = Pick<InputProps, "accept"> &
onFileRead: (text: string) => void;
};
export function FileButton({
export function RawFileButton({
accept,
iconOnly,
maxFileSizeMb = 20,
@@ -67,3 +68,5 @@ export function FileButton({
</>
);
}
export const FileButton = memo(RawFileButton, equal);