Disable warning for TabPanel count of 0
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3.1k
- Forks
- 455
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 2
Description
Hello,
I am using react-tabs with with success in my app.
In some places though, I use it with no panel at all. In that case, it is used to change a property on another component.
Stripped down example to illustrate:
const [page, setPage] = useState(0);
<Tabs selectedIndex={page} onSelect={setPage}>
<TabList>{ /* one Tab per page here */ }</TabList>
</Tab>
<DocumentView url={url} page={page} />
This works perfectly.
However, react-tabs complains that
There should be an equal number of 'Tab' and 'TabPanel' in
Tabs
It then continues happily and everything works fine.
- Do you see any issue with this use case?
- If not, would it be possible to silence that warning when the number of
TabPanels is exactly 0?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Tabs validation that emits the equal-number warning described in the issue. Check how it handles a TabPanel count of zero, then update the behavior so the warning is silenced only for that case and verify that other count mismatches still warn.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100