인프런 커뮤니티 질문&답변
(참고) Menu' components don't accept text as child elements. 오류
작성
·
329
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'.
Workspace/index.tsx에서 오류
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; }
답변
답변을 기다리고 있는 질문이에요
첫번째 답변을 남겨보세요!




