JSFiddle - React, Tailwind, and code Playground

by Simon Herteby

HTML

<div id="app">
  <button @click="toggle = !toggle">Open the console and click me</button>
  <parent v-if="toggle"></parent>
</div>

JavaScript

Vue.component('child', {
	template:'<div>Child</div>',
  created(){
  	console.log('Child created')
  },
	destroyed(){
  	console.log('Child destroyed')
  }
})
Vue.component('parent', {
	template:'<div>Parent<child></child></div>',
  created(){
  	console.log('Parent created')
  },
	destroyed(){
  	console.log('Parent destroyed')
  }
})
new Vue({
	el:'#app',
  data(){
  	return {
    	toggle:true
    }
  }
})