mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 19:19:26 +08:00
18 lines
334 B
TypeScript
18 lines
334 B
TypeScript
import type * as React from 'react';
|
|
|
|
export type RenderFunction = () => React.ReactNode;
|
|
|
|
export const getRenderPropValue = (
|
|
propValue?: React.ReactNode | RenderFunction,
|
|
): React.ReactNode => {
|
|
if (!propValue) {
|
|
return null;
|
|
}
|
|
|
|
if (typeof propValue === 'function') {
|
|
return propValue();
|
|
}
|
|
|
|
return propValue;
|
|
};
|