This question is related to JS and Vue2 framework.
I would like to understand what a specific line of code means, default: () => [],
. Why is the empty array set through the arrow function, and not just []?
export default {
props: {
items: {
type: Array,
required: false,
default: () => [],
},
},
};
Broader context:
I am trying to figure out the logic behind a vue autocomplete app.
Here is the full codepen:
https://codepen.io/alligatorio/pen/mXRGLg
Thanks!