Live data from Hacker News

Why we chose Vue.js over React

pixeljets.com

241–250 of 267 posts

Re: Why we chose Vue.js over React

#241
post #65

The arguments against JSX and React requiring many small components are very surface level and sound like "we couldn't figure out how to make it work for us so it must be impossible". 1. This was mentioned already, but, yes, you can use ternaries and boolean logic for simple conditionals (loggedIn && Logout || Login ) 2. When you need more markup, put them in an if-else statement in the same render function. render()…

When I see examples like this, it reminds me just how elegant & simple Mustache.js template can be: Mustache.render( "{{#loggedIn}}Hello{{userName}}{/loggedIn}} {{^loggedIn}}Please log in{{/loggedIn}}", state );

Elegant & simple?

Re: Why we chose Vue.js over React

#242
It has been quite some time since I started writing front end code, tried understanding angular, left it. I was lucky that I came across Vue.JS via HN, it was gitlab's post. I haven't ever tried React, because Vue is amazing. With nearly no knowledge of JS, I was able to write an app in Vue reading just the official docs, they are downright amazing. I faced the issue of webpack et al, thus I started writing a guide to write vue apps in vanilla JS,

https://github.com/thewhitetulip/intro-to-vuejs

This is a work in progress.

I feel Vue is gaining ground because of it's simple syntax, there isn't much magic to it, just enough magic.

Re: Why we chose Vue.js over React

#243

It has been quite some time since I started writing front end code, tried understanding angular, left it. I was lucky that I came across Vue.JS via HN, it was gitlab's post. I haven't ever tried React, because Vue is amazing. With nearly no knowledge of JS, I was able to write an app in Vue reading just the official docs, they are downright amazing. I faced the issue of webpack et al, thus I started writing a guide t…

Thanks for posting. I've just had a quick glance over the first chapter of your book and I like the simple approach you take to explaining the core elements of vue.js and SPAs.

Will be keeping an eye on your progress.

Re: Why we chose Vue.js over React

#244
post #243

It has been quite some time since I started writing front end code, tried understanding angular, left it. I was lucky that I came across Vue.JS via HN, it was gitlab's post. I haven't ever tried React, because Vue is amazing. With nearly no knowledge of JS, I was able to write an app in Vue reading just the official docs, they are downright amazing. I faced the issue of webpack et al, thus I started writing a guide t…

Thanks for posting. I've just had a quick glance over the first chapter of your book and I like the simple approach you take to explaining the core elements of vue.js and SPAs. Will be keeping an eye on your progress.

Thank you :-)

I plan to finish everything off in the next few days. The chapter5 contains a working version of the code, but it sure needs some refactoring.

If you want, I'll email you when the book is done. Leave an email id somehow :)

Re: Why we chose Vue.js over React

#245
post #65

The arguments against JSX and React requiring many small components are very surface level and sound like "we couldn't figure out how to make it work for us so it must be impossible". 1. This was mentioned already, but, yes, you can use ternaries and boolean logic for simple conditionals (loggedIn && Logout || Login ) 2. When you need more markup, put them in an if-else statement in the same render function. render()…

When I see examples like this, it reminds me just how elegant & simple Mustache.js template can be: Mustache.render( "{{#loggedIn}}Hello{{userName}}{/loggedIn}} {{^loggedIn}}Please log in{{/loggedIn}}", state );

What exactly is elegant and simple about that? I feel like this kind of syntax would break down on more complex examples, is that not the case? What would it look like with multiple conditions (say something like A && B || C)?

Re: Why we chose Vue.js over React

#246

Our company migrated to vue.js, 6 months ago. Our complex app is messy with JSX, router, and new dev can't keep up with code. Now we start every new app with Vue.js. The gap between junior dev and senior dev comes closer. They can collaborate with less bugs, less problems and less time to develop.

Interesting. I'm also looking at Vue.js and wondering how it can benefit me. Just one thing that I want to know: how do you do checks and tests in it? Are there any frameworks or tools to do that?

Re: Why we chose Vue.js over React

#247

Earlier quoted context omitted.

He may have chosen to use newer syntax, but the same pattern can be used without computed keys with only a tiny more code: var stateUpdate = {} stateUpdate[event.target.name] = event.target.value; this.setState=(stateUpdate); I don't think there was anything necessarily wrong with his tone as he was addressing the tone of the original article.

Telling someone, "or maybe you should learn JavaScript" is kind a really jerky way of saying, "you don't know what you're doing". I do think it was a terrible way to share knowledge. Yet it was an excellent way to say, "I know more than you".

I agree it is rather combative, however it's also true. To claim that X pattern is a reason to not use a library when said pattern is actually an anti-pattern you've used because of lack of understanding is going to garner these kinds of reactions.

Re: Why we chose Vue.js over React

#248

My man, a lot of the pain described in this article can be solved by Mobx: https://stackshare.io/mobx One of our engineers at StackShare[0] suggested it and it's fantastic. Mobx is very simple to understand and will make writing a "React" page a real joy again. Redux was way too complicated for what it gave, and just shot term after term after term at me that left me with a headache. I still don't understand Redux pr…

Ok, so I think I understand how MobX works. What I don't understand is how this is different from just having a global handler updateStore that runs a forceUpdate() on the root component. You set todo.done = true somewhere down the line and run updateStore. It will re-render everything and change wherever todo.done is used.

Re: Why we chose Vue.js over React

#249
I would stay far from Facebook products. Never know when you have been sued or forbidden to use they products. Haha these all boils down to freedom end of the day for me. I would not ever choose Facebook, Google or Twitter products for anything. They business is simply censorship packaged in fancy boxes.

Re: Why we chose Vue.js over React

#250
post #65

The arguments against JSX and React requiring many small components are very surface level and sound like "we couldn't figure out how to make it work for us so it must be impossible". 1. This was mentioned already, but, yes, you can use ternaries and boolean logic for simple conditionals (loggedIn && Logout || Login ) 2. When you need more markup, put them in an if-else statement in the same render function. render()…

Wow. Do people consider this kind of coding acceptable now? We spent decades trying to separate templates, business logic, and inlined JS, and you managed to cram all three into a short snippet.

Whether to show a logout link or a login form is presentation logic, not business logic.

I've spent decades telling people that trying to keep logic out of templates is a waste of time. A useful templating language has variables, conditionals, and even functions. There's no reason not to use a real programming language.

There's no good automated way to enforce MVC. How is an automated tool going to know whether "show this number to two decimal places" is a model thing (inherent precision of the data) or a view thing (presentation choice)?

Post reply on HN