ANP ANP - 2 months ago 23
React JSX Question

How do i add a line break in render()?

in my

render()
function i have the following code:

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>)

}


but it wont let me add the
<br />
at the end as coded, why is this and how do i fix this?

Answer

If the OP does not post an answer, I'd like to steal the points :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>
    ); 
  })
}
Comments