reactjs - 带有 Typescript 返回类型的样式化组件是任何
问题描述
我有一个组件,例如:
class Foo extends React.Component<SkeletonProps, any> { ... }
当我将它与样式组件一起使用时,例如:
const StyledFoo = styled(Foo)`height: 100px`
StyledFoo 的类型是 any(即没有特定的道具类型),我怎样才能让 StyledFoo 保持SkeletonProps
它的道具?
解决方案
安装对我有用的3rd
版本。hoist-non-react-statics
npm add hoist-non-react-statics@3
推荐阅读
- python - tkinter 使用 lambda 函数的多个按钮
- python - Open CV Contours - 将凹多边形拆分为多个凸多边形
- php - 将导出的 csv 保存到应用存储上的某个位置
- r - 使用 selectizeinput 搜索后选择数据中的行
- laravel - Npm run dev 在我的 laravel vue 项目中失败
- neo4j - 即使在 null 检查之后为什么我在 neo4j 中得到 null 值?
- c - 影响堆中另一个结构中的“静态”结构
- jq - 使用 jq 进行条件选择
- javascript - Bootstrap 4中菜单项之间的空格
- r - 也想找到包含 NA/空白值的数据框的平均值列