The way to extends a Trait.
Opened this issue · 1 comments
tanbowensg commented
What problem does this feature solve?
Sometimes traits need to be extended. For example, Validation Trait presets some rules, but the business logic always requires custom validation rules. Validation Trait needs to receive and register custom rules.
What does the proposed API look like?
Since the trait is a factory function, so one of the ways may be injecting dependencies in the trait's constructor function. And trait's dependencies can be passed in initSunmao
(not the dependencies
filed, but a new field).
Yuyz0112 commented
How about
- Pass the extended things as props if they are serializable.
- Implement a new trait.