UNPKG

react-tabs

Version:

An accessible and easy tab component for ReactJS

21 lines (16 loc) 432 B
import { deepForEach } from './childrenDeepMap'; import { isTab, isTabPanel } from './elementTypes'; export function getTabsCount(children) { let tabCount = 0; deepForEach(children, child => { if (isTab(child)) tabCount++; }); return tabCount; } export function getPanelsCount(children) { let panelCount = 0; deepForEach(children, child => { if (isTabPanel(child)) panelCount++; }); return panelCount; }