我刚刚{....0}在朋友的代码中找到了.在控制台返回中评估它{}(空对象).
这是为什么?JavaScript中4个点的含义是什么?
我想渲染一个ListItem以react-routerLink为根组件的组件,如下所示:
<ListItem
to="/profile"
component={Link}
>
Profile
</ListItem>
Run Code Online (Sandbox Code Playgroud)
但是,我收到 TypeScript 错误:
(50,15): error TS2339: Property 'to' does not exist on type 'IntrinsicAttributes & ListItemProps & { children?: ReactNode; }'.
Run Code Online (Sandbox Code Playgroud)
显然,组件to使用的 propLink是 props 接口的一部分ListItem......
如何解决这个问题?