Перейти к содержанию

Dynamic

{"<dynamic>"}

This component lets you insert an arbitrary Component or tag and passes the props through to it.

1
2
3
4
5
6
function Dynamic<T>(
  props: T & {
    children?: any;
    component?: Component<T> | string | keyof JSX.IntrinsicElements;
  }
): () => JSX.Element;

Here's an example of how you can use it:

1
<Dynamic component={<MyComponent>} someProp={state.something} />

Props

Name Type Description
component Component<T> | string | keyof JSX.IntrinsicElements The component to render.
children any The children to pass to the component.
... T Any other props to pass to the component.

Комментарии