import React from "react"; export interface EachProps { /** * 数据源 */ data?: T[]; /** * 自定义渲染器 */ render?: (item: T, index: number) => React.ReactNode; } export const Each = React.forwardRef( (props, ref) => { const { data, ...rest } = props; return (
{data?.map((item, index) => (
{props.render?.(item, index) ?? null}
))}
); } );