r/javascript • u/clickclickboo • Dec 19 '16
~15 years trying to make everyone separate HTML, JS & CSS. And then suddenly everything went south and we’re writing code like this.
https://twitter.com/thomasfuchs/status/810885087214637057
483
Upvotes
3
u/Retsam19 Dec 19 '16
No, most frameworks (Angular, KO, Ember, Backbone) maintained a far more traditional JS/HTML separation, until React came on the scene. It wasn't until React and JSX showed up that the "keep HTML and JS separate" idea was challenged.
It's in the JS file, using JS to attach events to the HTML elements. Like this:
HTML:
JS:
This is what "properly separated HTML and JS" has looked like for the last ~15 years. It looks a bit different if you use a framework, but it was always the same idea: HTML in one set of files, JS in others.