官术网_书友最值得收藏!

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>
    }
}
主站蜘蛛池模板: 开平市| 扬中市| 桂东县| 泽普县| 玉山县| 古交市| 信宜市| 抚宁县| 广汉市| 板桥市| 文成县| 安乡县| 电白县| 蒲江县| 疏附县| 大城县| 台湾省| 江口县| 石棉县| 潜江市| 宁德市| 高碑店市| 分宜县| 蛟河市| 民权县| 广德县| 迁西县| 南宁市| 赣榆县| 广汉市| 石屏县| 三穗县| 北票市| 临夏市| 娱乐| 高阳县| 北碚区| 黄冈市| 武川县| 西华县| 郓城县|