amis-rpc-design/node_modules/antd/es/form/hooks/useChildren.js

8 lines
263 B
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
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;
}