mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
fix(v2): fix build caused when one tab item (#1938)
* fix(v2): fix build caused when one tab item * Use React method
This commit is contained in:
parent
3e58062b91
commit
3b9309fa87
2 changed files with 7 additions and 2 deletions
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- **HOTFIX for 2.0.0-alpha.32** - Fix build compilation if exists only one code tab.
|
||||||
- Add table of contents highlighting on scroll.
|
- Add table of contents highlighting on scroll.
|
||||||
|
|
||||||
## 2.0.0-alpha.32
|
## 2.0.0-alpha.32
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, {useState} from 'react';
|
import React, {useState, Children} from 'react';
|
||||||
|
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
|
@ -31,7 +31,11 @@ function Tabs(props) {
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
<div className="margin-vert--md">
|
<div className="margin-vert--md">
|
||||||
{[...children].filter(child => child.props.value === selectedValue)[0]}
|
{
|
||||||
|
Children.toArray(children).filter(
|
||||||
|
child => child.props.value === selectedValue,
|
||||||
|
)[0]
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue