|
|
|
|
|
by ripley12
2572 days ago
|
|
> a component-based approach to UI development This is actually something that bothers me a lot about Angular. Yes, you can extract components, but the process of doing so is a lot more... heavyweight than in React. In React, I can trivially extract any piece of UI into a stateless functional component in the same file (and later on I can move it to another file for wider reuse if needed). It's just like extracting a method in non-web programming, it's something you do without even thinking about it. In Angular, that component needs to live in a separate file with a bunch of boilerplate and it needs to be registered in the module. This is OK for big components, but it's enough work that it's not practical to create tiny helper components frequently. |
|
I can agree with you there if by heavyweight you're referring to it's explicit definitions.
However, have you tried a "SharedModule"? You can throw any number of tiny components into however many shared modules (one shared module for your small-medium sized application vs n-number of lazily loaded shared modules for your large+ applications.)
I myself enjoy wrapping even helper components in modules because I then know exactly what a component needs and it's scope of dependencies.