Reactjs tabreact引导中的内容&;组件类道具
我试图将react组件传递到TabContentsReactjs tabreact引导中的内容&;组件类道具,reactjs,ecmascript-6,react-bootstrap,Reactjs,Ecmascript 6,React Bootstrap,我试图将react组件传递到TabContentscomponentClassprop中。此react组件还需要添加道具。我只是想知道这怎么可能 我试过一些类似的方法 import MyClass from './somewhere'; import { TabContent } from 'react-bootstrap'; const x = <MyClass thing={y} /> .. .. <TabContent componentClass={x} />
componentClass
prop中。此react组件还需要添加道具。我只是想知道这怎么可能
我试过一些类似的方法
import MyClass from './somewhere';
import { TabContent } from 'react-bootstrap';
const x = <MyClass thing={y} />
..
..
<TabContent componentClass={x} />
从“/somewhere”导入MyClass;
从“react bootstrap”导入{TabContent};
常数x=
..
..
但它不起作用,因为TabContent类的componentClass propType似乎需要元素或字符串。我想知道我能把需要道具的react组件传递到选项卡窗格的最佳方式是什么
只是为了额外的信息。我要传入的这个组件从挂载时的API或类似的东西获取数据。
MyClass
将继承TabContainer
中的所有道具。因此,您可以按原样传入组件,并在选项卡container
上设置您想要的道具
从“/somewhere”导入MyClass;
从“react bootstrap”导入{TabContent};
..
..
//我的班级将有“这个。道具。东西”。
所以您不想在TabContent
中呈现MyClass
?您想要实现什么?我试图在选项卡
中呈现MyClass
,这意味着我需要使用TabContent
,react引导文档意味着我需要将MyClass
传递到TabContent的componentClass
属性中