File size: 378 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import toArray from 'rc-util/lib/Children/toArray';
import type { FormItemProps } from '../FormItem';
export default function useChildren(
children?: FormItemProps['children'],
): FormItemProps['children'] {
if (typeof children === 'function') {
return children;
}
const childList = toArray(children);
return childList.length <= 1 ? childList[0] : childList;
}
|