Suppose I have an array of strings=["resource1", "resource2", "resource3"]. How do I create a table row out of these elements in html where the data in the row will be separated by spaces or commas such as resource1,resource2,resource3 and then be able to click these elements separately?
I know how to make some text clickable by using button tag but I want to individually be able to click these elements. The button tag makes the entire row clickable but I want to call a function when I click resource1 and then call some function when I click on resource2 and so on.
EDIT: I'm trying to render this table in react using jsx. So my tableData is like in an array called data= [{"id":1,"resources":"resource1,resource2,resource3"}] and then I'm trying to create a table using jsx as
<table>
<tr>
<th>ID</th>
<th>Resources</th>
</tr>
{data.map((val, key) => {
return (
<tr key={key}>
<td>{val.id}</td>
<td>{val.resources}</td>
</tr>
)
})}
</table>
So I want to be able to separately click resource1, resource2 and resource3.