JavaScript

JavaScript

Made by DeepSource

Properties of $slots should be used as a function JS-0658

Bug risk
Major
vue

this.$slots.default was an array of VNode in Vue.js 2.x, but changed to a function that returns an array of VNode in Vue.js 3.x.

Bad Practice

const children = [...this.$slots.default]
const children_ = this.$slots.default.filter(test)

Recommended

const children = this.$slots.default()
const children_ = this.$slots.default && this.$slots.default()