Skip to content

Commit 80fd7a4

Browse files
committed
Move hook invocation into separate component
1 parent 3fd3811 commit 80fd7a4

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/components/tabs/Tabs.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@ import {
1212
stringifyId
1313
} from '../../private/util';
1414

15+
// eslint-disable-next-line react/prop-types
16+
function TabPane({children, tabId, ...otherProps}) {
17+
return (
18+
<RBTab.Pane
19+
eventKey={tabId}
20+
key={tabId}
21+
data-dash-is-loading={getLoadingState() || undefined}
22+
{...otherProps}
23+
>
24+
{children}
25+
</RBTab.Pane>
26+
);
27+
}
28+
1529
/**
1630
* Create Bootstrap styled tabs. Use the `active_tab` property to set, or get the
1731
* currently active tab in a callback.
@@ -109,16 +123,15 @@ function Tabs({
109123
const tabId = tab_id || 'tab-' + idx;
110124

111125
return (
112-
<RBTab.Pane
113-
eventKey={tabId}
126+
<TabPane
114127
key={tabId}
115128
disabled={disabled}
116129
style={style}
117130
className={class_name || className}
118-
data-dash-is-loading={getLoadingState() || undefined}
131+
tabId={tabId}
119132
>
120133
{child}
121-
</RBTab.Pane>
134+
</TabPane>
122135
);
123136
});
124137
return (

0 commit comments

Comments
 (0)