skip to Main Content

Javascript – Object as a checkbox value

I have an array of objects and I map through them. {alltasks.map((task) => ( <div key={task.task}> <input type="checkbox" name="task" id={task.task} value={task} className="hidden peer check" /> <label for={task.task} className="inline-flex items-center justify-between w-full p-5 text-white bg-transparent border-2 border-slate-600 rounded-lg cursor-pointer peer-checked:border-emerald-500 hover:border-emerald-700">…

VIEW QUESTION

Javascript – How do I make an array of objects in react JS

My API gives me data in the following format: { status: 200, certificateTypes: [ { id: 1, name: 'Gasmeting', created_at: '2023-04-25T07:15:55.000000Z', updated_at: '2023-04-25T07:15:55.000000Z', }, { id: 2, name: 'Mangatwacht', created_at: '2023-04-25T07:16:13.000000Z', updated_at: '2023-04-25T07:16:13.000000Z', }, ], // ... } I used…

VIEW QUESTION
Back To Top
Search