Skip to content

Commit 82fa40d

Browse files
authored
refactor(Tab): convert to FC (react-bootstrap#5721)
1 parent 7bf9898 commit 82fa40d

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

src/Tab.tsx

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,22 @@ export interface TabProps extends Omit<TabPaneProps, 'title'> {
1212
tabClassName?: string;
1313
}
1414

15-
/* eslint-disable react/require-render-return, react/no-unused-prop-types */
16-
class Tab extends React.Component<TabProps> {
17-
static propTypes = {
18-
title: PropTypes.node.isRequired,
19-
};
20-
21-
public static Container = TabContainer;
22-
23-
public static Content = TabContent;
24-
25-
public static Pane = TabPane;
26-
27-
render() {
28-
throw new Error(
29-
'ReactBootstrap: The `Tab` component is not meant to be rendered! ' +
30-
"It's an abstract component that is only valid as a direct Child of the `Tabs` Component. " +
31-
'For custom tabs components use TabPane and TabsContainer directly',
32-
);
33-
return null;
34-
}
35-
}
36-
37-
export default Tab;
15+
const propTypes = {
16+
title: PropTypes.node.isRequired,
17+
};
18+
19+
const Tab: React.FC<TabProps> = () => {
20+
throw new Error(
21+
'ReactBootstrap: The `Tab` component is not meant to be rendered! ' +
22+
"It's an abstract component that is only valid as a direct Child of the `Tabs` Component. " +
23+
'For custom tabs components use TabPane and TabsContainer directly',
24+
);
25+
};
26+
27+
Tab.propTypes = propTypes;
28+
29+
export default Object.assign(Tab, {
30+
Container: TabContainer,
31+
Content: TabContent,
32+
Pane: TabPane,
33+
});

0 commit comments

Comments
 (0)