-
카테고리
-
세부 분야
프론트엔드
-
해결 여부
미해결
(참고) Menu' components don't accept text as child elements. 오류
22.12.25 09:10 작성 조회수 236
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; }
답변을 작성해보세요.
답변 0