mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-16 01:41:02 +08:00
3e22b505a3
* proper react import fix for #22708 * update iconutil in select * update in tree component
19 lines
394 B
TypeScript
19 lines
394 B
TypeScript
import * as React from 'react';
|
|
|
|
export type RenderFunction = () => React.ReactNode;
|
|
|
|
export const getRenderPropValue = (
|
|
propValue?: React.ReactNode | RenderFunction,
|
|
): React.ReactNode => {
|
|
if (!propValue) {
|
|
return null;
|
|
}
|
|
|
|
const isRenderFunction = typeof propValue === 'function';
|
|
if (isRenderFunction) {
|
|
return (propValue as RenderFunction)();
|
|
}
|
|
|
|
return propValue;
|
|
};
|