Working with react and having to use angular now, and my impression is that react is way more composable and you can simply replace a tag with a HOC, add or remove attributes also with HOC.
I am trying to understand how to do the same with angular but seems pretty crazy the examples I see around.
best way I could find to compose html without hacks or extra code, is by using the selector as the template and I need write the tag like .
Problem with this is that if for example I would like to use the same component but as a link I would need to explicitly do which works but if there are extra styles or extra tags needed this is problematic and I would need to rely on extra code in the component level.
In react this is trivial and can be generalized for any arbitrary tag.
const AnyTag = (BaseTag: any) => (props: any) => (
<BaseTag {...props} />
);
Same for adding attributes to a tag, a function can cover every possible case of an extra attribute.
const AnyTagWithExtraAttributes = (BaseTag, extraAttrib) => (props) => <BaseTag {...props} {...{[extraAttrib]:""}} />;
So question is, are there any similar ways to achieve that in angular? and if not, why? Do we even have a easy way to achieve HOC in angular?
I found the article below but looks crazy that all that is needed, anything simpler around that anyone could point me to? which does not rely on fiddling with the runtime generated code? https://blog.nrwl.io/metaprogramming-higher-order-components-and-mixins-with-angular-ivy-75748fcbc310
Thanks a lot.