1
に子コンポーネントに
小道具として使用できません。この<Listing />
コンポーネントでキーは、私は以下のように<strong>マップ</strong>関数で動的に生成されたコンポーネント以下た親コンポーネント有しReactJs
const renderListing = this.props.listing.map(function(list, index) {
return (
<Listing
key={index}
title={list.title}
totalWorkers={list.totalWorkers}
/>
);
}, this);
を、私は以下のようにreact-md
からチェックボックス:
import { Checkbox } from "react-md";
class Listing extends React.Component {
render() {
return (
<Checkbox id="`listSector-${this.props.key}`" name="list-sector" />
);
}
}
私は0という名前小道具を与えたかったですはid="listSector-0" , id="listSector-1"
と連結されています。
私は文字列リテラルを試しましたが、すべてが呼び出されました。
this.props.key
をid
のcheckbox
に連結する方法を知っている人はいますか?
おかげ