JSFiddle - React, Tailwind, and code Playground

by darkylmnx

HTML

<div id="app">
  
   <p>hello {{ name(1, 2) }}</p>
   <p>hello {{ nameNormal }}</p>
  <button @click="renders++">force render {{ renders }}</button>
  
</div>

Vue

new Vue({
	el: '#app',
  
  data() {
  	return {
    	dep: 'TOTO',
    	renders: 1
    }
  },
  
  computed: {
  	name() {
    	console.log('computed');
    	
    	return (a, b) => {
      	console.log('computed func')
      	return this.dep + ' ' + (a + b)
      }
    },
    
    nameNormal() {
    	console.log('computed normal');
      this.dep
    }
  }
})