interface TableViewLayoutRow { title:string; component:JSX.Element; } interface TableViewLayoutProps { datas:Array; } const TableViewLayout = (props:TableViewLayoutProps) => { function makeRow(data:TableViewLayoutRow,id:number) { if(data.title==="") { return ( {data.component} ) } else { return ( {data.title} {data.component} ) } } return ( { props.datas.map(data => { const id = props.datas.indexOf(data); return makeRow(data,id) }) }
) }