vendredi 27 novembre 2015

Adding a checkbox in React when input is declared void

This is my problem, I have a list being rendered and returned as seen below:

return (
        <li className="itemsInList">{this.props.children}</li>
    )

but I want to add a checkbox so if I do this:

return (
        <input type="checkbox" className="itemsInList">{this.props.children}</input>
    )

but then an error is displayed: arning: input is a void element tag and must not have children

how can I get around this error to display them in a list with a checkbox?




Aucun commentaire:

Enregistrer un commentaire