Skip to content

Commit 7069a2a

Browse files
authored
Merge pull request #4 from Commencis/feature/lazy-load-icons
feat: remove icons from server-side bundle to decrease bundle size
2 parents 6757a99 + 92d76fa commit 7069a2a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/common/Icon/Icon.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use client';
2+
13
import { ReactElement, useMemo } from 'react';
24
import dynamic from 'next/dynamic';
35

@@ -14,7 +16,7 @@ export const Icon = ({
1416
}: IconProps): ReactElement => {
1517
const IconComponent = useMemo(
1618
(): DynamicIconReturnType =>
17-
dynamic(() => import(`@/assets/icons/${name}.svg`)),
19+
dynamic(() => import(`@/assets/icons/${name}.svg`), { ssr: false }),
1820
[name]
1921
);
2022

0 commit comments

Comments
 (0)