TypeScript 사용이 처음이라 사용방법이 꽤나 어렵다,,,ㅍㅁㅍ
interface pageCompent {
des: string;
component: JSX.Element;
}
function selectedComponent(name: string):pageCompent {
switch (name) {
case "page-name":
return {des: "ABC", component: <ABCPage />};
...
}
export default function XYZPage({params: {name}}: IParams) {
const { des, component } = selectedComponent(name);
return (
<div>
<div>
<MenuNavigation menuName={des} />
</div>
<div>
{component}
</div>
</div>
);
}