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:
Alexey Pyltsyn 2019-11-05 04:30:44 +03:00 committed by Yangshun Tay
parent 3e58062b91
commit 3b9309fa87
2 changed files with 7 additions and 2 deletions

View file

@ -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>
);