UNPKG
antd-v5
Version:
latest (5.14.1)
5.14.1
An enterprise-class UI design language and React components implementation
ant.design
antd-v5
/
es
/
form
/
hooks
/
useChildren.js
8 lines
•
263 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
import
toArray
from
"rc-util/es/Children/toArray"
;
export
default
function
useChildren
(
children
) {
if
(
typeof
children ===
'function'
) {
return
children; }
const
childList =
toArray
(children);
return
childList.
length
<=
1
? childList[
0
] : childList; }