mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 17:31:25 +08:00
1719748a29
* chore: eslint add consistent-type-imports * fix avatar * Update Item.tsx
19 lines
399 B
TypeScript
19 lines
399 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;
|
|
}
|
|
|
|
const isRenderFunction = typeof propValue === 'function';
|
|
if (isRenderFunction) {
|
|
return (propValue as RenderFunction)();
|
|
}
|
|
|
|
return propValue;
|
|
};
|