Reactjs 如何将道具传递到材质中的自定义根组件-ui@next什么时候使用打字脚本?
我想将带有react routerReactjs 如何将道具传递到材质中的自定义根组件-ui@next什么时候使用打字脚本?,reactjs,typescript,react-router,material-ui,Reactjs,Typescript,React Router,Material Ui,我想将带有react router链接的ListItem组件呈现为根组件,如下所示: 显然,链接组件使用的to道具是列表项道具界面的一部分 如何解决此问题?TypeScript不会拒绝使用prop-spread语法传递的额外道具,因此它可以: <ListItem {...{to: "/profile"}} component={Link}> Profile </ListItem> 轮廓 (50,15): error TS2339: Pr
链接的ListItem
组件呈现为根组件,如下所示:
显然,链接
组件使用的to
道具是列表项
道具界面的一部分
如何解决此问题?TypeScript不会拒绝使用prop-spread语法传递的额外道具,因此它可以:
<ListItem {...{to: "/profile"}} component={Link}>
Profile
</ListItem>
轮廓
(50,15): error TS2339: Property 'to' does not exist on type 'IntrinsicAttributes & ListItemProps & { children?: ReactNode; }'.
<ListItem {...{to: "/profile"}} component={Link}>
Profile
</ListItem>