jeudi 15 août 2019

How to grab checkboxes and put them into state?

My problem is the following: I have a table, where I generate a row with a person's name, details and details2 from an object in the DB. Next to each person there is a checkbox. I need to put those on check into an object in state and remove them from there when unchecked, because I am going to send this object on submit to the server.

How and what is the best way to do that?

I tried with current.value but I am going in circles and I don't think I have the correct idea.

    <tr>
        <td>
            <table >
                <tbody>
                    <tr>
                        <td>
                            <div>
                                <input type="checkbox"/>
                                <label>
                                    data 1
                                </label>
                            </div>
                        </td>
                        <td data-title="Column 2">
                            data 2
                        </td>
                        <td >
                            <a href="#">
                                Edit
                            </a>
                            <a href="#"></a>
                                Delete
                            </a>
                        </td>
                        <td data-title="Column 5">
                            data 3
                        </td>
                    </tr>
                </tbody>
            </table>
        </td>
    </tr>```




Aucun commentaire:

Enregistrer un commentaire