` 是 `React.ComponentClass` 与 `React.StatelessComponent
` 的组合,所以你可以接受一些可以用作 Props 类型和使用 JSX 渲染的组件。
```ts
const X: React.Component = foo; // from somewhere
// Render X with some props:
;
```
### React JSX Tip: 可渲染的接口
React 可以渲染一些像 `JSX` 或者是 `string` 的内容,这些被合并到类型 `React.ReactNode` 中,因此,当你接收可渲染的内容时,你可以使用它:
```tsx
type Props = {
header: React.ReactNode;
body: React.ReactNode;
};
class MyComponent extends React.Component {
render() {
return (
{this.props.header}
{this.props.body}
);
}
}
Header} body={body} />
```
### React JSX tip: 接收组件的接口
React 声明文件提供 `React.ReactElement` 的接口,可以让你注解一个类组件实例化的返回值``,如:
```tsx
class MyAwesomeComponent extends React.Component {
render() {
return Hello
;
}
}
const foo: React.ReactElement = ; // Okay
const bar: React.ReactElement = ; // Error!
```
::: tip
你也可以将其用做函数参数的注解,或者是 React 组件的 prop 注解。
:::
### React JSX tip: 接收可以作为 props 的组件,并且使用 JSX 渲染它
类型 `React.Component` 合并了 `React.ComponentClass` 和 `React.StatelessComponent
`,因此,你可以接收一些使用 `Prop` 类型的组件,并使用 JSX 渲染它:
```tsx
const X: React.Component = foo // 来自其他地方
// 渲染 X
```
### React JSX tip: 泛型组件
它完全能按我们预期工作,如:
```tsx
// 一个泛型组件
type SelectProps = { items: T[] };
class Select extends React.Component, any> {}
// 使用
const Form = () =>