mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
eaeb75eb44
* type: type refactor * chore: fix type WrapProps * chore: remove generic of Component --------- Co-authored-by: 张宁宁 <zhangnn1@yonghui.cn>
14 lines
312 B
TypeScript
14 lines
312 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;
|
|
}
|
|
|
|
return typeof propValue === 'function' ? propValue() : propValue;
|
|
};
|