# Function __createDynamicComponent

- __createDynamicComponent(optDef, options?, dsa): ((props) => Element)

- Create a React component from a subapp definition

  #### Parameters

  - optDef: SubAppOptions | SubAppDef
  - options: CreateComponentOptions = {}

    options

  - dsa: ((options) => SubAppDef)
    - - (options): SubAppDef

      - Declare a subapp.

        NOTE: A webpack plugin will statically analyze the code to extract the subapp info so options must be a literal object in place. It cannot be a variable declared elsewhere.

        GOOD:

            export const subapp1 = declareSubApp({
              name: "Subapp1",
              getModule: () => import("subapp1")
            })

        BAD:

            const subappInfo = { name: "Subapp1", getModule: () => import("subapp1")};
            export const subapp1 = declareSubApp(subappInfo);

        #### Parameters

        - options: SubAppOptions

          options

        #### Returns SubAppDef

        subapp definition

  #### Returns ((props) => Element)

  a React Component

  - - (props): Element

    - #### Parameters

      - props: any

      #### Returns Element

  - Defined in packages/xarc-react/src/common/create-component.tsx:106