I'm new to VueJS and have a very basic question. If I have a JS variable and want to parse it into a Vue instance data section how can this be done? In my simple example below I want to parse my variale "parsedJSON" into Vue instance "mainVue" under data section in the variable called "test":
let parsedJSON = fetch(url)
.then(function(response){
return response.json();
}).then(function (data){
console.log(data)
});
let mainVue = new Vue({
el: '#mainContent',
data: {
test: ""
}
})
In my entire code the "parsedJSON" variable consist of JSON data from a mongoDB, which is fetched fine, but I cant seem to find a way to parse it into my Vue instance. The correct data is displayed in the console.