I'm working on a lightning component that should be modular in the sense that it works with many sObject types. I want to be able to drop the component into different sObject record detail pages. For example, the component could be added to the record detail pages for
custom_object_D__c. The ID of the record would be used to identify the sObject type by taking the key prefix of the ID and using describe to return the sObject type. The component itself would have some input fields that would filter against a lookup table and return specific values for a picklist field that would then update a custom text field on the custom object that the component has been added for that record detail page.
I'm wondering about how the best approach to structure the component. Should I have a container component that takes the record ID, gets the sObject Type and then passes that down into another component that that can then use the generic sObject type and cast to the appropriate type. Or, should I just use one component for all the logic?