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,5 +1,3 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { icons } from "@/components/icons";
|
||||
|
||||
import { BaseButton, BaseButtonProps } from "./base";
|
||||
@@ -7,7 +5,5 @@ import { BaseButton, BaseButtonProps } from "./base";
|
||||
export type ClearButtonProps = Omit<BaseButtonProps, "icon" | "labelText">;
|
||||
|
||||
export function ClearButton({ iconOnly, ...props }: ClearButtonProps) {
|
||||
const icon = useMemo(() => <icons.X size={16} />, []);
|
||||
|
||||
return <BaseButton {...props} {...{ icon, iconOnly }} labelText="Clear" />;
|
||||
return <BaseButton {...props} icon={<icons.X size={16} />} {...{ iconOnly }} labelText="Clear" />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user