Practices - Do you avoid directly modifying the DOM from your components?
23/12/2019 5:04 PM by
- Smaller component code making it easier to maintain
- Faster running and easier to write unit tests
- Easier for designers to get involved
This means that the component's state must expose things that are useful to the template as public properties or fields, and the Angular should read these fields to draw itself.
- This component manipulates the DOM directly to show and hide the menu
- This component sets component state, which the template can use. It is simpler, more descriptive and easier to test
Do you feel this rule needs an update?