【发布时间】:2018-09-21 19:47:54
【问题描述】:
我想用 react-router Link 渲染一个 ListItem 组件作为根组件,如下所示:
<ListItem
to="/profile"
component={Link}
>
Profile
</ListItem>
但是,我收到 TypeScript 错误:
(50,15): error TS2339: Property 'to' does not exist on type 'IntrinsicAttributes & ListItemProps & { children?: ReactNode; }'.
显然,Link 组件使用的to 属性是ListItem 属性接口的一部分...
如何解决?
【问题讨论】:
标签: reactjs typescript react-router material-ui