我正在尝试将此简单添加div
到我的 .tsx 文件的返回块中:
<div id="bizible.reportUser" style="display:none" data-email="some@email.com"/>
我这样做是通过以下方式:
import React from 'react';
import Radium from 'radium';
import Icon from './Icon';
import Header from './Header';
import Colors from '../colors';
const NoMatch = ({ children, title, icon, kind }) => {
return ([
<div style={[styles.base, kind && styles[kind]]}>
<Icon name={icon} style={[styles.icon]} height="48" width="48" />
<Header title={title} style={[styles.header]} />
<p style={[styles.message]}>
{children}
</p>
</div>,
<div id="bizible.reportUser" style="display:none" data-email="some@email.com"/>
]
);
};
但它返回一条错误消息并且不编译:
error TS2322: Type '({children, title, icon, kind}: { children: any; title: any; icon: any; kind: any; }) => Element[]' is not assignable to type 'StatelessComponent<Props>'.
Type 'Element[]' is not assignable to type 'ReactElement<any>'.
Property 'type' is missing in type 'Element[]'.