1. jQueryはシンプルに書けるVue・Reactは冗長
証拠 https://jsfiddle.net/t62b49mp/
JavaScriptのコードはこれだけ
$('.my-component [name="switch"]').change(function() {
$(this).closest('.my-component').toggleClass('active', this.checked);
});
2. 信者「Vueならこれだけで動く!」
嘘1 isActive=false
嘘2 new vue({data:{isActive:false}})
https://codepen.io/anon/pen/MxmrjP (動かない)
嘘3
new Vue({
el: '#app',
data: {isActive:false},
})
https://codepen.io/anon/pen/XGgpZV (変な動きをする)
3. 結論
jQueryはシンプルに書けるVue・Reactは冗長
証拠 https://jsfiddle.net/t62b49mp/
JavaScriptのコードはこれだけ
$('.my-component [name="switch"]').change(function() {
$(this).closest('.my-component').toggleClass('active', this.checked);
});
2. 信者「Vueならこれだけで動く!」
嘘1 isActive=false
嘘2 new vue({data:{isActive:false}})
https://codepen.io/anon/pen/MxmrjP (動かない)
嘘3
new Vue({
el: '#app',
data: {isActive:false},
})
https://codepen.io/anon/pen/XGgpZV (変な動きをする)
3. 結論
jQueryはシンプルに書けるVue・Reactは冗長