🐛 fix(genericIconComponent): wrap ForwardedIconComponent with memo to improve performance by preventing unnecessary re-renders

🔨 refactor(genericIconComponent): improve code readability by adding line breaks and indentation for better code organization and readability
This commit is contained in:
cristhianzl 2024-03-07 09:07:48 -03:00
commit 07e1d2a459

View file

@ -1,9 +1,10 @@
import dynamicIconImports from "lucide-react/dynamicIconImports"; import dynamicIconImports from "lucide-react/dynamicIconImports";
import { Suspense, forwardRef, lazy } from "react"; import { Suspense, forwardRef, lazy, memo } from "react";
import { IconComponentProps } from "../../types/components"; import { IconComponentProps } from "../../types/components";
import { nodeIconsLucide } from "../../utils/styleUtils"; import { nodeIconsLucide } from "../../utils/styleUtils";
const ForwardedIconComponent = forwardRef( const ForwardedIconComponent = memo(
forwardRef(
( (
{ {
name, name,
@ -46,6 +47,7 @@ const ForwardedIconComponent = forwardRef(
</Suspense> </Suspense>
); );
} }
)
); );
export default ForwardedIconComponent; export default ForwardedIconComponent;