vendredi 29 décembre 2017

Inline event handler practice javascript

I am reading about Events on the Mozilla, here it talks about "Inline events handlers" these should not be used and are considered a bad practice.

e.g.

<button onclick="bgChange()">Press me</button>

However, in frameworks such as Angular we do something like:

<my-component (click)="onClick($event)"></my-component>

Is this not contradicting to what bad practice is considerd by Mozilla in this case.

If this question needs to be asked in another section, please do let me know.




Aucun commentaire:

Enregistrer un commentaire