Hi @tarasm, Sorry if I’m being dense about this, but I’m not yet seeing the difference. It seems Ember Views also have “template & javascript mixed together”. Here’s how I would write your example in Ember:
var LikeButton = Ember.View.extend({
init: function() {
this._super()
this.set('liked', false};
},
likedText: function(){
return(this.get('liked') ? 'like' : 'unlike')
}.property('liked'),
click: function(event) {
this.set('liked', !this.get('liked')); // or this.toggleProperty('liked')
},
template: Ember.Handlebars.compile("
<p>
You {{likedText}} this. Click to toggle.
</p>
")
});
LikeButton.create().appendTo('#example')
Help me understand – how is this different than React.js? We’ve changed some names (e.g. render => template, handleClick => click) but, as far as I can tell, the code samples are nearly identical.