type Props = {
Component: ???
}
const AnotherComp = ({Component}: Props) => (
<Component />
)
为组件添加道具的正确方法是什么?
答案 0 :(得分:2)
pivot.join(filt).rename(columns={'code Date': 'count'})
# code group High Medium count code
# rec
# 10001 2015-11-05 NaT 2 X11
# 10002 2015-10-04 2015-10-04 1 X11.1
答案 1 :(得分:1)
您正在寻找的类型称为ReactClass
。任何组件的类型都是ReactClass<any>
。
答案 2 :(得分:0)
type Props = {
Component: React.Component<*>
};
class React.Component<P = {}, S = {}>
interface React.Component<P = {}, S = {}>
答案 3 :(得分:0)
我认为这就是您要寻找的:
// Component we want to pass as a prop
class MyComponent extends React.Component<{}> {}
type Props = {
Component: React.Element<typeof MyComponent>
}
const AnotherComp = ({ Component }: Props) => (
<Component />
)
文档链接:https://flow.org/en/docs/react/types/#toc-react-element