vtils

Home > react > renderComponent

renderComponent() function

独立渲染一个组件在 document.body 下,常应用于弹窗类组件。

Signature:

export declare function renderComponent<TComponent extends React_2.ComponentType<any>>(Component: TComponent, initialProps: React_2.ComponentProps<TComponent>, injectCallbacks?: PickProperties<React_2.ComponentProps<TComponent>, Function | undefined>): RenderComponentResult<TComponent>;

Parameters

Parameter Type Description
Component TComponent 要渲染的组件
initialProps React_2.ComponentProps<TComponent> 初始属性
injectCallbacks PickProperties<React_2.ComponentProps<TComponent>, Function | undefined> (Optional) 回调函数注入

Returns:

RenderComponentResult<TComponent>