如何將對象列表'標記'中的值添加到我的ReviewTag組件並生成所有標記?將數據附加到組件,並從對象列表中循環
這裏是我的代碼:
var ReviewTag = React.createClass({
render: function() {
var tags = [{"id": 1, "name": "friendly"}, {"id": 2, "name": "comfortable"}, {"id": 3, "name": "fast"}];
return (
<div>
<input type="checkbox" id="TAG_ID" name="TAG_NAME"/><label htmlFor="TAG_NAME">Tag name</label>
</div>
);
}
});
,我想呈現的其他成分的所有標籤,但我不知道如何做到這一點?
<div className="characteristics-column">
<ReviewTag/> //how can I render this tags with data from 'tags' variable ?
</div>
非常感謝您的各種幫助解決方案。
看到我的答案波紋管 – madalinivascu