具体报错信息
“Button”不能用作 JSX 组件。
Its type ‘(props: IProps) => React.ReactElement’ is not a valid JSX element type.
不能将类型“(props: IProps) => React.ReactElement”分配给类型“(props: any, deprecatedLegacyContext?: any) => ReactNode”。
不能将类型“ReactElement<any, string | JSXElementConstructor>”分配给类型“ReactNode”。
类型 “ReactElement<any, string | JSXElementConstructor>” 中缺少属性 “children”,但类型 “ReactPortal” 中需要该属性

解决方案
方式一.将tsconfig.json的配置

“compilerOptions” : {
	// "jsx": "react-jsx" 注释掉 改为"jsx": "react"
	"jsx": "react"
}

方式二.安装 @types/react

npm install @types/react 
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐