>  Q&A  >  본문

ReactDom.render가 반환한 유형이 필요한 유형과 일치하지 않는 문제를 해결하는 방법은 무엇입니까?

마크다운 렌더링이 주요 초점입니다. 또한 문자열로 전달된 HTML을 구문 분석해야 합니다.

children은 문자열로 전달된 HTML이라고 가정할 수 있습니다. isParseRequired true

로 전달됩니다. 으아아아

제가 받은 오류는 다음과 같습니다. src/app/components/Markdown/index.tsx:48:7 - 错误 TS2322: 类型 '({children, isParseRequired }: {children: string; isParseRequired?: boolean | undefined; }) => void | Element' 不可分配给类型 'FC<{children: string; isParseRequired?: 布尔值 |不明确的; }>'。

참고: 저는 *.tsx

를 사용하고 있습니다.

PS: 원본은 https://github.com/orgs/remarkjs/discussions/1188

에 게시되었습니다.
P粉289775043P粉289775043380일 전570

모든 응답(1)나는 대답할 것이다

  • P粉162773626

    P粉1627736262023-09-10 09:17:37

    ReactDom.render를 제거하고 ReactMarkdown을 조각 태그로 감싸서 FC로 돌아가서 rehype-raw 플러그인을 사용하세요

    으아악

    회신하다
    0
  • 취소회신하다