I trying to create a table dynamically from the data received from an ajax response in a react app. The loop is created from the response of an ajax request inside the useEffect hook. The problem is that I can't make work the onClick attribute in an anchor tag in a table cell. Below is the code.
res.data.users.forEach(function (user) {
let row = table.insertRow(rowcnt);
let cell1 = row.insertCell(0);
let cell2 = row.insertCell(1);
let cell3 = row.insertCell(2);
cell1.innerHTML = user.u_id;
cell2.innerHTML = user.username;
cell3.innerHTML = '<a href="javascript:void(0)"><span data-feather="edit"></span></a><a href="javascript:void(0)" onClick={(e) => deleteUser(e, ' + user.id + ')}><span data-feather="trash"></span></a>';
rowcnt++;
});
But in the frontend it is showing
Please help.

innerHTML = "element string"for much more readable code. Your onClick is also confusing, what are you trying to do with it?