I'm trying to build a component based app, which most of the code should be reusable, also with some other stylesheets etc.
The goal is, that we have some core components, which we can use for other projects too. They should be extendable, so you can customize the style, functionality, etc.
Now I'm trying to find a solution for my problem: I'd like to have a mechanism, that when I extend a component, the application already loads the extended component and not the super component. I know I could create a new component for the extended one, but so I have to adapt the code in the whole application.
A little example: I have a component EditableList, with a basic styling and logic and a round button component (ListButton). The EditableList component is used as it is in the App1.
Now in the App2, I'd like to extend/overwrite the ListButton component, that it is no longer round one, but a rectangular one (RectListButton). However when I extend the component, I have to create a new component (for example RectListButton), copy the code of EditableList into a new component, change the ListButton to RectListButton(in the EditableList component) and use that new EditableList2 component in my App2.
Is there any possibility to have a factory which recognizes, that I have extended that component and loads the extended component instead the base component? That means for my example, I just have to extend the ListButton and the EditableList component automatically detects, that the ListButton got overwritten and loads my extended RectListButton in (or maybe ListButtonExtended for a better naming). Thus, I can reuse the EditableList component, without copying and modifying it.
Thank you very much!
Regards Fabian