1
マップ機能でアレイオブジェクトを表示できません。誰かが私になぜ教えてもらえますか?私がこのオブジェクトをコンソールに表示しようとすると、正しく表示されます。React.js - テーブル内の配列オブジェクトを表示する
class ProductsGrid extends React.Component {
constructor(props) {
super(props);
}
render() {
return (<Table striped bordered condensed hover>
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Description</th>
<th>Url</th>
</tr>
</thead>
<tbody>
{this.props.products !== null ?
JSON.parse(this.props.products).map((product, index) => {
<tr>
{console.log(product.IdProduct)}
<td>{product.IdProduct}</td>
<td>{product.Name}</td>
<td>{product.Description}</td>
<td>{product.UrlFriendlyName}</td>
</tr>
}) : <tr><td></td><td></td><td></td><td></td></tr>}
</tbody>
</Table>);
}}
あなたのマップ機能はリターンが必要ですか? –
もちろん...愚かな間違い、すみません。私はこれを1時間のように過ごしています。 – TjDillashaw
何十年もプログラミングの間違いの多くを作りました:-)私の答えがこれを行う次の人に役立つことを願っています。 –