vendredi 4 août 2017

How to set name for a checkbox in react jsx

I'm trying to set the name in a checkbox input but it seems it doesn't work:

const DepartmentRow = ({ data }) =>
<tbody>
  <tr>
    <td><input type="checkbox" name="ListOfDepartments" value={data.department}/>
      <span>{data.departament}</span>
    </td>
  </tr>
</tbody>;

DepartmentRow.propTypes = {
    data: PropTypes.object
};

In data I receive an user object that has a department. If I write:

<td>{data.department}</td>

it works and it displays the name of the department, so I receive the right information on data.

This is what I got for the moment: enter image description here

And I want this: enter image description here

Thank you!




Aucun commentaire:

Enregistrer un commentaire