ant-design/components/_util/getRenderPropValue.ts
flyflydogdog eaeb75eb44
chore: type refactor ()
* type: type refactor

* chore: fix type WrapProps

* chore: remove generic of Component

---------

Co-authored-by: 张宁宁 <zhangnn1@yonghui.cn>
2023-12-09 13:31:45 +08:00

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;
};