Edit this page

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

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:

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


componentComponent<T> | string | keyof JSX.IntrinsicElementsThe component to render.
childrenanyThe children to pass to the component.
...TAny other props to pass to the component.
Report an issue with this page