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 ).
In questa pagina del sito puoi guardare il video online React JS - Loading Components Dynamically From an Array della durata di ore minuti seconda in buona qualità , che l'utente ha caricato JTECH 05 marzo 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 2,350 volte e gli è piaciuto 17 spettatori. Buona visione!