React - Dynamically Import Components

前端 未结 8 1566
别那么骄傲
别那么骄傲 2020-12-05 07:14

I have a page which renders different components based on user input. At the moment, I have hard coded the imports for each component as shown below:

    imp         


        
8条回答
  •  有刺的猬
    2020-12-05 08:05

    You can bundle your components as micro-apps and hot load them into your application from a url. Here is a poc that supports dynamically importing components and micro-apps from a route based on a configuration on the site level.

    https://github.com/eschall/react-micro-frontend

提交回复
热议问题