Greetings to the community! This is my first question on the StackOverflow.
I use vue.js-v2 and webpack. I need to have immutable data available for child components. The components are loaded via the vue-router. Different pages need the same data.
I import data from a JSON file and integrate it into vue with a "main.js":
//main.js
import Vue from 'vue'
import ...
import myData from './path/file.json' // [{},{},{}...]
Vue.prototype.$storage = myData
new Vue({ router, .....
Then I use in different components something like:
//pageX.vue
...
this.componentVar = this.$storage.filter((x) => x.name === 'needName')
And somehow it works. I worry if I'm doing the right thing. I am afraid of duplicating data in components or something like that, because my knowledge of javascript is deplorable :(