Currently, I am working on initializing a map that would be utilized in my calculatePrice function.
calculatePrice(key) {
let prices = new Map({
0: 17,
1: 19,
2: 24,
3: 27,
4: 30,
5: 46,
6: 50,
7: 54,
8: 58,
9: 67,
10: 75,
});
let price = prices.get(key);
return price;
},
However, considering the frequent invocation of this method (using @change within a form field), it might not be efficient for performance to create this object every time the method is called. Is there a better location within a view component to store "prices" where it can be initialized when the page loads and accessed whenever the method is invoked without requiring recreation?