타입 정의
"use client";
import React from "react";
type ExampleType = {
Icon: React.ReactElement;
};
const Example = ({ Icon }: ExampleType) => {
return (
<div>
{Icon}
</div>
);
};
export default Example;
타입 정의 방법 : React.ReactElement로 정의 후 JSX로 렌더링
사용 예시
import Example from "./Example";
import { Psychology, Science, Engineering, MedicalServices, Gavel, Palette, Business, School, Agriculture, Waves, Policy } from '@mui/icons-material';
const MainContainer = () => {
const icons = [
{ Icon: <Psychology /> },
{ Icon: <Psychology /> },
{ Icon: <Science /> },
{ Icon: <Engineering /> },
{ Icon: <MedicalServices /> },
{ Icon: <Gavel /> },
{ Icon: <Palette /> },
{ Icon: <Business /> },
{ Icon: <School /> },
{ Icon: <Agriculture /> },
{ Icon: <Waves /> },
{ Icon: <Policy /> },
];
return (
<div>
{colleges.map((el, idx) => (
<Example key={idx} Icon={el.Icon} />
))}
</div>
);
};
export default MainContainer;
'라이브러리 > MUI' 카테고리의 다른 글
[MUI] <Drawer/> 애니메이션 버그 해결 방법 | MUI <Drawer /> 애니메이션이 적용되지 않는 이유 (0) | 2025.03.18 |
---|---|
[MUI] Next15 | notistack 사용방법 | 스낵바 UI 구현 | 토스트 UI 구현 (0) | 2025.03.08 |
[MUI] 아코디언 <Accordion/> 기본 그림자(box-shadow) 제거 (0) | 2025.03.03 |
[MUI] Drawer 테두리 둥글게 변경하기 (0) | 2025.02.21 |
[MUI] <Select /> 기본 스타일링 (0) | 2025.02.06 |
타입 정의
"use client";
import React from "react";
type ExampleType = {
Icon: React.ReactElement;
};
const Example = ({ Icon }: ExampleType) => {
return (
<div>
{Icon}
</div>
);
};
export default Example;
타입 정의 방법 : React.ReactElement로 정의 후 JSX로 렌더링
사용 예시
import Example from "./Example";
import { Psychology, Science, Engineering, MedicalServices, Gavel, Palette, Business, School, Agriculture, Waves, Policy } from '@mui/icons-material';
const MainContainer = () => {
const icons = [
{ Icon: <Psychology /> },
{ Icon: <Psychology /> },
{ Icon: <Science /> },
{ Icon: <Engineering /> },
{ Icon: <MedicalServices /> },
{ Icon: <Gavel /> },
{ Icon: <Palette /> },
{ Icon: <Business /> },
{ Icon: <School /> },
{ Icon: <Agriculture /> },
{ Icon: <Waves /> },
{ Icon: <Policy /> },
];
return (
<div>
{colleges.map((el, idx) => (
<Example key={idx} Icon={el.Icon} />
))}
</div>
);
};
export default MainContainer;
'라이브러리 > MUI' 카테고리의 다른 글
[MUI] <Drawer/> 애니메이션 버그 해결 방법 | MUI <Drawer /> 애니메이션이 적용되지 않는 이유 (0) | 2025.03.18 |
---|---|
[MUI] Next15 | notistack 사용방법 | 스낵바 UI 구현 | 토스트 UI 구현 (0) | 2025.03.08 |
[MUI] 아코디언 <Accordion/> 기본 그림자(box-shadow) 제거 (0) | 2025.03.03 |
[MUI] Drawer 테두리 둥글게 변경하기 (0) | 2025.02.21 |
[MUI] <Select /> 기본 스타일링 (0) | 2025.02.06 |