NP Neil Footy
NP Neil Footy

Reputation: 73

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?

Upvotes: 0

Views: 6421

Answers (1)

Mihir
Mihir

Reputation: 3902

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

Upvotes: 4

Related Questions