reactjs - 如何在 Material UI TableRow 上放置一个 React Router Link
问题描述
我正在尝试在我的Material UI TableRow元素上放置一个Link
组件表单React Router Dom
<TableRow component={Link as any} to={`/company/${company.id}`} className="clt-row" key={company.id}>
但我不断收到以下错误
Property 'to' does not exist on type 'IntrinsicAttributes & TableRowProps & { children?: ReactNode; }'. TS2769
如何解决此错误?
解决方案
行需要单元格。component
prop 表示要用于行的根节点的组件。它默认只是 atr
但可以是任何将 a 呈现tr
为根节点的组件。
<TableRow>
<TableCell colSpan={3}> // or however many columns are in your table
<Link to={`/company/${company.id}`} className="clt-row" key={company.id} />
</TableCell>
</TableRow>
推荐阅读
- android - ConstraintLayout 与不断增长的 TextViews 在需要时声称相等的空间
- iis - AD 组的 IIS 10 .Net 授权问题
- laravel - 在 Laravel 中将用户分配到任何商店时遇到问题
- vue.js - 如何仅强制用户输入数字
- php - 如何显示上次发布的帖子?
- android - 通知不适用于变量(Android)
- bash - 如何使用循环将多个输入目录传递给hadoop命令
- python - 如何反向返回具有偶数索引的可迭代项
- c++ - 从文件的一行中读取字符
- cassandra - 当新的时间戳值等于前一个时间戳值时,DataStax/Cassandra 使用时间戳的行为是不可预测的