今天TSX文件报错内容如标题,经过查证才知道组件的命名要首字母大写,示例代码如下:
import React from "react"; import Condition from './Condition'; interface propsTypes { } function KeyWordDom(props:propsTypes){ return (<> <Condition></Condition> </> ) } const keyWord = React.forwardRef((props: any, ref: any) => { return <KeyWordDom {...props} myRef={ref}></KeyWordDom>; }); export default keyWord;
如果keywordDom的K是小写的就会报如标题错误