r/javascript • • Nov 03 '16

Vue.js is the most trending framework of github. 117 stars per day

http://bestof.js.org/tags/framework/trending/this-month
321 Upvotes

132 comments sorted by

View all comments

Show parent comments

3

u/__env Nov 04 '16

As someone who has spent a lot of time working in angular, I feel like it's simply not true that this

<div ng-repeat="user in ctrl.users">{{ ::user.name | lowercase }}</div>

reduces boilerplate any more than this

users.map(user => <div>{user.name.toLowerCase()}</div>)

Directives and components both reduce boilerplate in the same way --

<div users-list="users"/>

vs.

<UsersLists users={users}/>

Seems like the same idea to me.

There is a ton, a ton, a ton, of boiler plate involved in writing redux, but that has nothing to do with the view layer.

1

u/icanevenificant Nov 04 '16

That's if you ignore the render function and return around it.

1

u/Lhaer Nov 04 '16

Yes but we're not even talking about Redux, and actually I think that React combined with other technologies like Redux is amazing, that's really when React shines. But it is true that JSX does not provide a lot of basic functionality that a template engine like the ones provided by Angular and Vue does, and that's because JSX was not designed to be a templating engine at all, that's just a fact and as your project grows it becomes an inconvenience. But if I just want a minimal framework that's simple, effective and at the same time fast, I'd pick Vue over React any time.

1

u/au_travail Nov 30 '16
 <div ng-repeat="user in ctrl.users">{{ ::user.name | lowercase }}</div> 

is declarative,

users.map(user => <div>{user.name.toLowerCase()}</div>) 

is imperative.

1

u/__env Dec 01 '16

Lol, what? They only differ in semantics -- repeating function takes a collection as an argument mapping a transform on a particular property -

repeat(user => pipe(get(user, 'name'), lowercase)(user), users) 

1

u/au_travail Dec 01 '16

JavaScript is an imperative language, HTML/Handlebars a declarative one.

1

u/__env Dec 01 '16

React is a declarative, efficient, and flexible JavaScript library for building user interfaces.

I guess the Facebook engineers are all totally wrong, though -- I mean, what do they know.

1

u/au_travail Dec 06 '16

Svelte and Vue.js creators agree with me that templates and raw javascript are very different. Templates can be statically analysed enough, but javascript cannot:

https://www.reddit.com/r/javascript/comments/5fcwhz/svelte_the_magical_disappearing_ui_framework/dalmpxx/?context=122

https://github.com/sveltejs/svelte/issues/23#issuecomment-263726445

I would still add to them that the main difference in statical analysability is caused by the facts that JavaScript is an imperative language and that HTML/Handlebars is a declarative one.