Bug: Tabs Component Required More Than 1 Tab
jwdotjs opened this issue · 1 comments
jwdotjs commented
If you create a Tabs component and put only one tab inside it, it will through an invariant:
invariant.js:38 Uncaught Invariant Violation: Objects are not valid as a React child (found: object with keys {title, children}). If you meant to render a collection of children, use an array instead or wrap the object using createFragment(object) from the React add-ons. Check the render method of `Tabs`.
Reproducable Sample Code
<Tabs align='top'>
<Tab title='All'>
hi
</Tab>
</Tabs>
We should handle this one of two ways:
- Update the tabs component to allow 1 or many tabs
- Throw an error if we have less than 2 tabs, saying that 2 or more tabs are required.
I think option 1 would be better if possible, there may be situations where tabs are dynamically generated and the user may only have one.
afogarty72 commented