Hacker News new | ask | show | jobs
by tambourine_man 2065 days ago
Thanks for sharing. I have very little experience with game engines but React/Vue always resembled them to me a bit. Here's the data, render when changed. I just don't think it's needed in most Web cases.

Sure, if you attach behavior code to every interactive element directly, all of which are controlling the same portion of the screen and depending on each other, it's a recipe for a mess.

If, however, you call somewhat generalized functions on those events, with basic DRY strategies in mind, it's all very clear and manageable well into the thousands of lines, with no need of running a gaming engine in JS, creating a templating language that must be transpiled, etc.

edit: >less manual code

jQuery code if often smaller and clearer, I mean check this classic:

jQuery: https://github.com/tastejs/todomvc/blob/gh-pages/examples/jq...

React: https://github.com/tastejs/todomvc/blob/gh-pages/examples/re... https://github.com/tastejs/todomvc/blob/gh-pages/examples/re... https://github.com/tastejs/todomvc/blob/gh-pages/examples/re... https://github.com/tastejs/todomvc/blob/gh-pages/examples/re... https://github.com/tastejs/todomvc/blob/gh-pages/examples/re...

1 comments

And that was my original point, using React for a small one page thing like this is grossly overkill but Vue is a good smaller alternative at this scale that gives you most benefits.

I looked at the jQuery example above and checked the Vue example in the same repo. That example has about as many lines total but the Vue example is 30% smaller in total due to shorter lines.

https://github.com/tastejs/todomvc/tree/gh-pages/examples/vu...