React JS - Loading Components Dynamically From an Array

Veröffentlicht am: 05 März 2021
auf dem Kanal: JTECH
2,350
17

In this video I explain my approach on how to load components dynamically from an array in React JS. Here, I map the array elements and store the component name in a variable, the variable is then used to load the right component. Depending variable's position, its value might show on the web page, I created a hoc to hide it.

This approach is useful when we want to load components based on state, store values, or other information that we received from a server/backend. There are other approaches that can be used, but this is easy to grasp for beginners.

I built this project upon Material UI for React. In fact, the components that I am loading are Material UI icons.

You can find the source code on https://github.com/judabne/react-dyna... . This isn't a complete project, it just holds the code for loading my components from arrays (   • React JS - Loading Components Dynamically ...  ), adding transitions (   • React JS - Adding Transitions to Pages and...  ), and creating forms (   • React JS - Creating Forms from the State  ).


Auf dieser Seite können Sie das Online-Video React JS - Loading Components Dynamically From an Array mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer JTECH 05 März 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 2,350 Mal angesehen und es wurde von 17 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!