Skip to content

Md2Poster在Next.js中导入异常:“Md2Poster”不能用作 JSX 组件。 其类型“ForwardRefExoticComponent<Md2PosterProps & RefAttributes<Md2PosterRef>>”不是有效的 JSX 元素类型。 #41

@hailing3

Description

@hailing3

使用官网测试代码,在Next.js页面,引入Md2Poster报错:
`import {
Md2Poster,
Md2PosterContent,
Md2PosterFooter,
Md2PosterHeader,
} from "markdown-to-image";
import "markdown-to-image/dist/style.css";

function TestPage() {
const markdown = ...;

return (

Poster Header
{markdown}
Powered by ReadPo.com

);
}

export default TestPage;`

报错信息:

“Md2Poster”不能用作 JSX 组件。
其类型“ForwardRefExoticComponent<Md2PosterProps & RefAttributes>”不是有效的 JSX 元素类型。
不能将类型“ForwardRefExoticComponent<Md2PosterProps & RefAttributes>”分配给类型“(props: any, deprecatedLegacyContext?: any) => ReactNode”。
不能将类型“import("/Users/lishaoming/node_modules/@types/react/index").ReactNode”分配给类型“React.ReactNode”。
不能将类型“bigint”分配给类型“ReactNode”。ts(2786)

ps:Next.js新手,请多指教~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions