• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    미해결

(참고) 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 부분에서 오류 난 것

 

코드

  • 이전 코드(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

답변을 작성해보세요.

답변을 기다리고 있는 질문이에요.
첫번째 답변을 남겨보세요!