【发布时间】:2019-08-31 17:36:19
【问题描述】:
当用户点击下面的tableCell文本时,他应该导航到http://localhost:3000/crayons/${rows.id}
我不确定如何编辑以下代码来执行以下操作
<TableBody>
{props.rows.slice(page).map(row => (
<TableCell align="center">{row.crayon_color}</TableCell>
</TableBody>
我尝试了什么
<TableCell align="center" numeric component="a" href=`http://localhost:3000/crayons/${rows.id}`> {row.crayon_color}</TableCell>
【问题讨论】:
-
您是否使用任何类型的路由器?
/crayons是您应用程序的一部分吗?查看react-router-dom你可以找到GitHub repo here -
@MattOestreich 是的,它是我的 react-router-dom 的一部分
标签: javascript reactjs