Hacker Newsnew | past | comments | ask | show | jobs | submit | flying-pig's commentslogin

With bundler like esbuild, all JS code, including 3rd party libraries can be bundled into a single file. You don't need an extra round trip for a library.


Well said! You got the point.


> when every framework ends up importing jquery anyways

Evidence?


No offense. What exactly is the cost of using "var" instead of "const"? You seem to pretend it to be a big deal.


It sacrifices maintainability and robustness to save a measly 80 bytes (I counted).


JSX is redundant, at best. VanJS demonstrated ordinary JavaScript syntax is as good as JSX, if not better. How can something feel sugar-ish if it's actually more verbose than ordinary JS code? Plus, you can't really execute JSX code in browser's developer console.


> How can something feel sugar-ish if it's actually more verbose than ordinary JS code?

I personally find XML much easier to parse than a lot of nested callbacks and I especially like that content is always inside tags, rather than another argument as part of the library's functions. p("Hello, world") is readable enough, but as soon as you start adding html attributes, it becomes less legible to me:

li(a({href: "https://vanjs.org/"}, "VanJS"))

vs.

<li><a href="https://vanjs.org/">VanJS</a></li>

I'm certain some people probably prefer the former over the latter, but I much prefer how JSX/XML reads. I can immediately tell where the content starts and in formatted code, I think it's a lot easier to see visually where things start and end, because of closing tags, instead of just a parentheses.


tbh, you don't need JSX to know where things begin and end (if this is something really important for you):

li(a({href: "https://vanjs.org/"}, "VanJS")/*a*/)/*li*/


The fact that you have to manually maintain the binding between states and UI elements and propagate state changes to UI elements is exactly the thing offered by VanJS, or other popular reactive frameworks (despite with a much larger bundle size)


Sure thing. But it's also one of those things that comes back to bite you when you least expect it: https://vanjs.org/advanced#why-not-dom-valued-states


I don't get you. Could you elaborate?


In the example I linked, the VanJS state cannot contain an element reference.

This would lead to unexpected results. So you have to be careful with state management, regardless of whether it's automated or not. There are similar pitfalls, including performance issues, with any state management system, hence dedicated state management solutions like Redux exist to address this.

The core of the argument is that complexity sometimes cannot be avoided. You can quickly wind up with moving this complexity elsewhere, e.g. by pulling in an additional library dependency. This results in having to learn, master and manage additional dependencies. Whether that's fundamentally better than the explicit and straight forward way depends on the scope of the project and its specific requirements. There's no silver bullet in any case and pros and cons with every approach.


Tbh I can't follow your logic here. You mentioned that in VanJS there are things that need to be careful with. But the same is true for other frameworks, even for plain Vanilla JavaScript. Thus what exactly the point that you're trying to make?

Complexity can't be avoided for extremely complex use cases. But that doesn't mean a simple solution that can work for most of the use cases has no value.


Agreed. JSX is a bug, not a feature.


... and imposes a build step, for no good reason.


The preact team also dislikes transpiling jsx so they've developed an alternative using tagged template literals: https://github.com/developit/htm


FWIW, VanJS's performance is very impressive. At least much better than React: https://vanjs.org/#performance


Very neat API indeed! Thanks for bringing it up.


https://vanjs.org is another example in that direction. It illustrates that it's even possible to have a full-fledged solution of composing complex reactive DOM tree with just plain JavaScript functions.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: