【问题标题】:grid component in materia ui材质ui中的网格组件
【发布时间】:2021-11-22 15:44:09
【问题描述】:

我有这个代码,但我收到了这个错误:

No overload matches this call.
  Overload 1 of 2, '(props: { component: ElementType<any>; } & SystemProps<Theme> & { children?: ReactNode; classes?: Partial<GridClasses>; ... 14 more ...; zeroMinWidth?: boolean; } & CommonProps & Omit<...>): Element', gave the following error.
    Property 'component' is missing in type '{ children: Element; item: true; lg: 4; mmd: number; md: 3; ssm: number; sm: 4; key: string; }' but required in type '{ component: ElementType<any>; }'.
  Overload 2 of 2, '(props: DefaultComponentProps<GridTypeMap<{}, "div">>): Element', gave the following error.
    Type '{ children: Element; item: true; lg: 4; mmd: number; md: 3; ssm: number; sm: 4; key: string; }' is not assignable to type 'IntrinsicAttributes & SystemProps<Theme> & { children?: ReactNode; classes?: Partial<GridClasses>; ... 14 more ...; zeroMinWidth?: boolean; } & CommonProps & Omit<...>'.
      Property 'mmd' does not exist on type 'IntrinsicAttributes & SystemProps<Theme> & { children?: ReactNode; classes?: Partial<GridClasses>; ... 14 more ...; zeroMinWidth?: boolean; } & CommonProps & Omit<...>'.ts(2769)
OverridableComponent.d.ts(17, 7): 'component' is declared here.
<Grid
    item
    lg={4}
    mmd={4}
    md={3}
    ssm={6}
    sm={4}
    key={`col${item.id}`}
>

为什么会出现这个错误?

【问题讨论】:

  • 您能否在代码 sn-p 中添加更多代码? 周围应该有一个 ,请也包含该部分。
  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: reactjs typescript material-ui next.js


【解决方案1】:

我找到了发生这种情况的原因。因为我在网格中使用 mmd 它无法识别

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-12-21
    • 2020-11-04
    • 1970-01-01
    • 2021-09-06
    • 2020-06-05
    • 1970-01-01
    • 2017-03-24
    • 1970-01-01
    相关资源
    最近更新 更多