在我的render()
函数中,我有以下代码:
render:function(){
var cbCollection = this.state.cbData.map(function(elem, index) {
return <label><input type = "checkbox" name = "cbCodes" id = "cb-{index}" value={elem.Id}/>{elem.DiagCodes}</label><br />
})
return(<div>rest of the code</div>)
}
但它不会让我在编码时添加<br />
,为什么会这样,我该如何解决?
答案 0 :(得分:3)
如果OP没有发布答案,我想偷点:D
render: function(){
var cbCollection = this.state.cbData.map(function(elem, index) {
return (
<div>
<label>
<input type="checkbox" name="cbCodes" id="cb-{index}" value{elem.Id} />
{elem.DiagCodes}
</label>
<br />
</div>
);
})
}