vue props with type object/array must use a factory function to return the default value. code example

Example: vue props with type object/array must use a factory function to return the default value.

/**
 * A property that is not required but has a specific type needs a default value.
 */
props: {
  // Default type - empty array
  sections: {
    required: false,
    type: Array,
    default: () => [], // Shorthand return function
  },
    
  // Default type - empty object
  question: {
    required: false,
    type: Object,
    default: () => {}, // Shorthand return function
  },
}