mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2025-12-17 04:59:23 +00:00
refactor: memoize icons on export
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useMemo } from "react";
|
||||
import { useCallback } from "react";
|
||||
|
||||
import { icons } from "@/components/icons";
|
||||
|
||||
@@ -18,7 +18,12 @@ export function CopyButton({ text, iconOnly, ...props }: CopyButtonProps) {
|
||||
});
|
||||
}, [text]);
|
||||
|
||||
const icon = useMemo(() => <icons.Copy size={16} />, []);
|
||||
|
||||
return <BaseButton {...props} {...{ icon, iconOnly, onClick }} labelText="Copy" />;
|
||||
return (
|
||||
<BaseButton
|
||||
{...props}
|
||||
icon={<icons.Copy size={16} />}
|
||||
{...{ iconOnly, onClick }}
|
||||
labelText="Copy"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user