Reactjs Typescript说我用样式化组件包装的组件上不存在道具
我正在使用语义ui react和样式化组件。我用样式化组件包装Tab组件,以自定义其外观。这是密码Reactjs Typescript说我用样式化组件包装的组件上不存在道具,reactjs,typescript,styled-components,semantic-ui-react,Reactjs,Typescript,Styled Components,Semantic Ui React,我正在使用语义ui react和样式化组件。我用样式化组件包装Tab组件,以自定义其外观。这是密码 const CustomTab = styled(Tab)<{props: TabProps}>` flex: 1; display: flex; margin-top: 10px; flex-direction: column; `; const CustomTab=styled(制表符)` 弹性:1; 显示器:flex; 边缘顶部:10px; 弯曲
const CustomTab = styled(Tab)<{props: TabProps}>`
flex: 1;
display: flex;
margin-top: 10px;
flex-direction: column;
`;
const CustomTab=styled(制表符)`
弹性:1;
显示器:flex;
边缘顶部:10px;
弯曲方向:立柱;
`;
如您所见,我试图指定CustomTab
的道具与Tab
组件的道具相同。我是根据答案做的
问题是typescript似乎仍然认为我的CustomTab
组件上不存在菜单
道具
我哪里出错了?试试
const CustomTab=styled(Tab)
您基本上将props定义为如下所示的对象:
{props:{TabProps}}
尝试const CustomTab=styled(Tab)
您基本上将props定义为如下所示的对象:{props:{TabProps}}