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
|
@ -5,7 +5,7 @@
|
|||
* 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';
|
||||
|
||||
|
@ -31,7 +31,11 @@ function Tabs(props) {
|
|||
))}
|
||||
</ul>
|
||||
<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>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue