I have this Tabs
component that allows you customize some parts of the layout through properties.
For example, you can have a custom layout for the New Tab Button or for what's rendered by default when you open a new Tab.
On the first case, the Tabs
component can receive a Component
class / function as a prop called customTabComponent
that will be used to create each Tab
element:
<Tabs customComponent={MyCustomComponent} ... />
However, on the second case, the content would be always the same, so Tabs
could receive a React's element as property instead of a component:
render () {
const defaultContent = <DefaultTabContent prop1={x} prop2={y}/>
return (
<Tabs defaultTabContent={defaultContent} ... />
)
}
Does it make sense to pass an Element
as prop instead of a Component
? If yes, Tabs
component would use this element for every new tab. Should the Tabs
component clone the passed element for each new Tab?