In a React
app I have a Table
tbody
of which looks the following way:
<tbody>
{
this.state.datasets.map((datasetName, idx) => {
return (<tr>
<td>
<div className={"pretty p-default p-curve"}>
<input id = {"datasetCheckBox" + idx}
checked = {this.state.checkBoxSelected === datasetName}
type="radio" name="datasetName"
onChange={(e) => this.checkBoxSelected(datasetName, e)}/>
<div className={"state p-primary"}>
<label>{idx}</label>
</div>
</div>
</td>
<td>{datasetName}</td>
<td>{datasetsJSON["datasets"][datasetName]["region"]}</td>
<td>{datasetsJSON["datasets"][datasetName]["authors"]}</td>
<td>
<a href={datasetsJSON["datasets"][datasetName]["link"]}>{datasetName}</a>
</td>
</tr>)
}, this)
}
</tbody>
The link is shown with an empty href
even though other parameters of the table from datasetsJSON["datasets"][datasetName]
are set correctly. I tried using React Router
and the only piece of code that redirected to links is in the answer here:
But in the answer to the question above if I set path="/"
, when the table loads, it is just redirecting me straight away to the first link. I would expect then that for each link the path
should be different, but supplying datasetsJSON["datasets"][datasetName]["link"]
as a path
does not work either. Why is the simple link a
empty? How could I fix it?