why we can't use `this` in `hooks` property methods?
conwnet opened this issue · comments
new Vue({
hooks() {
// we can't use `this` here
console.log(this); // undefined
useEffect(function() {
// but we can use `this` here when we use `function` keyword
console.log(this); // vm;
}, []);
},
});
see above, we can use this
in many other property methods like data
, mounted
, updated
and so on but hooks
, why do we design it like this?