2

我正在尝试向我的 StyledComponents (Emotion-React) 添加类型。假设我有一个样式化的 Button 组件,当我使用通用 StyledComponent 声明它的类型时,我需要向它传递 3 个类型变量:

const Button : StyledComponent<Props, InnerProps, Theme> = 
    styled("button")`
        cssProp:cssVal:
    `

Props 和 InnerProps 有什么区别?InnerProps 只是孩子吗?

4

1 回答 1

0

来自情感github:

  • InnerProps是类型参数,表示 props 的类型
  • 内部组件(样式的目标)
  • ExtraProps是类型参数,表示额外的道具类型
  • 样式化的组件。
于 2019-01-31T13:10:40.773 回答