Creating a reusable component with lifecycle events?

Is there a way to create a reusable component with lifecycle events?

From what I can see, components are reusable across content types, but the component definition only contains the data fields and I’ve not found a way to customize its lifecycle events in a reusable way. I want to create reusable components where the data fields and their associated logic for lifecycle events are contained in the same entity so that I don’t have to repeat the same lifecycle modifications manually for every content-type where the component is included.

For example, the component may contain a ‘computed’ field that has a value based on other field values in the component, and now I have to implement that logic on save/update in every content-type using that component instead of the component itself.

What is the best way to achieve this?