DEV Community

Discussion on: React.js with Factory Pattern ? Building Complex UI With Ease

Collapse
 
ashkanmohammadi profile image
Amohammadi2

The only other solution that I can think of, is to use an object which has component types as keys and the actual components as values.

Then you can map your component type to the object keys to instantiate different types of components

To add a new type, you'll just need to add another key & value pair to the object