Skip to content

Commit

Permalink
fix(v2): support rendering of singular tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Nov 26, 2020
1 parent aa2daf1 commit 4f36a72
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/docusaurus-theme-classic/src/theme/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import React, {useState, cloneElement} from 'react';
import React, {useState, cloneElement, Children} from 'react';
import useUserPreferencesContext from '@theme/hooks/useUserPreferencesContext';
import type {Props} from '@theme/Tabs';

Expand All @@ -22,14 +22,14 @@ function Tabs(props: Props): JSX.Element {
const {
lazy,
block,
children,
defaultValue,
values,
groupId,
className,
} = props;
const {tabGroupChoices, setTabGroupChoices} = useUserPreferencesContext();
const [selectedValue, setSelectedValue] = useState(defaultValue);
const children = Children.toArray(props.children)

if (groupId != null) {
const relevantTabGroupChoice = tabGroupChoices[groupId];
Expand Down

0 comments on commit 4f36a72

Please sign in to comment.