小编Mis*_*ist的帖子

为什么 {....0}评价为{}?

我刚刚{....0}在朋友的代码中找到了.在控制台返回中评估它{}(空对象).

这是为什么?JavaScript中4个点的含义是什么?

javascript number-literal spread-syntax

78
推荐指数
3
解决办法
8988
查看次数

使用 TypeScript 时如何将 prop 传递给material-ui@next 中的自定义根组件?

我想渲染一个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......

如何解决这个问题?

typescript reactjs react-router material-ui

5
推荐指数
1
解决办法
752
查看次数