Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit f73bb20

Browse files
Refactored Tabs
1 parent cf1f0ab commit f73bb20

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

dash_core_components/dash_core_components.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Tabs.react.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@ import React, {Component} from 'react';
33
import PropTypes from 'prop-types';
44
import R from 'ramda';
55

6-
const NoChildrenError = {
7-
name: 'NoChildrenError',
8-
message: 'Tabs did not have any children Tab components!',
9-
};
10-
6+
// EnhancedTab is defined here instead of in Tab.react.js because if exported there,
7+
// it will mess up the Python imports and metadata.json
118
const EnhancedTab = ({
129
id,
1310
label,
@@ -119,10 +116,13 @@ export default class Tabs extends Component {
119116
this.selectHandler = this.selectHandler.bind(this);
120117
this.parseChildrenToArray = this.parseChildrenToArray.bind(this);
121118

122-
// this.parseChildrenToArray();
119+
this.NoChildrenError = {
120+
name: 'NoChildrenError',
121+
message: 'Tabs did not have any children Tab components!',
122+
};
123123

124124
if (!this.props.children) {
125-
throw NoChildrenError;
125+
throw this.NoChildrenError;
126126
}
127127

128128
if (!this.props.value) {
@@ -219,7 +219,7 @@ export default class Tabs extends Component {
219219
);
220220
});
221221
} else {
222-
throw NoChildrenError;
222+
throw this.NoChildrenError;
223223
}
224224
if (!selectedTab) {
225225
throw new Error(

0 commit comments

Comments
 (0)