上QQ阅读APP看书,第一时间看更新
Component encapsulation
A component is one JS class. Do you want to include another component in your component? Just import it:
import {ProductDetail} from "./ProductDetail"; interface Props { products: Product[]; } export class ProductList extends React.Component<Props, undefined> { render() { return <p> {this.props.products.map(th => <ProductDetail key={th.id} product={th} />)} </p> } }