0👍
Ur arrow function is not well defined, since you will be using variables from outside the direct scope of the function you should define its body, it cannot be inline as the response => response.json()
, then you should write it like this
getSurveyData() {
fetch('http://localhost:8081/survey.json')
.then(response => response.json())
.then(data => {
this.surveyData = data
}
);
}
- [Vuejs]-Can I return a value from a watcher? VUE
- [Vuejs]-Problems with reactivity and computed properties Vue 3 – Composition API
Source:stackexchange.com