如何在 React 表中制作可点击的列数据?

Tho*_*tin 6 javascript api html-table reactjs react-table

我正在使用 React Table(React Bootstrap Table-2)在页面中显示一个表,并用来自数据库 API 的数据填充它。我想让其中一列中的值显示为链接(hrefs)。此特定列仅包含 URL。我想要实现的是,如果我点击每一行的 url("show report") - 它应该打开一个带有相应行 ID 的新选项卡。如何在 React Bootstrap Table-2 中实现这一点?

我试过:

{
datafield : "report",
text : "Show report",
accessor : "link",
Cell : (e) => <a href={e.value}> {e.value} </a>
},
Run Code Online (Sandbox Code Playgroud)

{
datafield : "report",
text : "Show report",
accessor : "link",
Cell : (e) => <a href={e.value}> {e.value} </a>
},
Run Code Online (Sandbox Code Playgroud)

小智 8

列数据添加如下:

{
  dataField : "report",
  text : "Show report",,
  formatter: (cell, row) => <a href={cell}> {cell} </a>
}
Run Code Online (Sandbox Code Playgroud)