HTML:
<div id="app">
<button @click="inc">Counter</button>
<h1>{{ counter }}</h1>
</div>
JS:
const view = new Vue({
el: '#app',
data: {
counter: 0
},
methods: {
inc: () => {
++this.counter
}
}
})
Receiving Cannot read property 'counter' of undefined
when I click on the button. To me, this should work, but I'm new to Vue and wondering if I'm missing something obvious!