Hacker News new | ask | show | jobs
by ftxrcc 3145 days ago
Because it works, it's simple (requires not much overhead), and sometimes it's just the best option.

This "hurr jQuery and everything it brought sucks" mentality is not good.

1 comments

HTML is for displaying information, not being littered with things js needs to query for and access. That's the whole point of using something like vue?

Put a function on the vue component that will make a request, keep all the data stuff in vue.

While I largely agree, that's not really true...

React for example wrecks your HTML with react related attributes on every DOM element.

There is nothing wrong with storing some information in the DOM.

>There is nothing wrong with storing some information in the DOM.

Except you're coupling your application state with the document model. If you ever do anything to change the DOM later on, (like installing React into your codebase) it'll come back to bite you in the ass hard, as now you need to find a means to communicate state that you just threw into the DOM like it were a slightly more acceptable global variable.

This is not the same as what gitlab is doing. React had attributes in order to remount correctly on the client side after a server render, this was removed. Using the latest react versions have nothing on the dom that isn't specifically needed to render correctly.