nto*_*ier 7 css dom reactjs tsx
我正在尝试将这个简单的添加div到我的 .tsx 文件的返回块中:
<div id="bizible.reportUser" style="display:none" data-email="some@email.com"/>
Run Code Online (Sandbox Code Playgroud)
我这样做:
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"/>
]
);
};
Run Code Online (Sandbox Code Playgroud)
但它返回一个错误消息并且不编译:
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[]'.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3990 次 |
| 最近记录: |