작성
·
322
2
'Menu' components don't accept text as child elements. Text in JSX has the type 'string', but the expected type of 'children' is 'Element'.
Menu 컴포넌트에서 interface Props를 children 부분에서 오류 난 것
해결 참고한 사이트 : Text in JSX has the type 'string', but the expected type of 'children' is 'string | Element | Element[]
이전 코드(components/Menu/index.tsx)
interface Props {
show: boolean;
onCloseModal: (e: any) => void;
style: CSSProperties;
closeButton?: boolean;
children: JSX.Element;
}
수정 코드(components/Menu/index.tsx)
interface Props {
show: boolean;
onCloseModal: (e: any) => void;
style: CSSProperties;
closeButton?: boolean;
children: React.ReactNode;
}
답변