S
S
squadbrodyaga2021-04-11 08:51:24
Vue.js
squadbrodyaga, 2021-04-11 08:51:24

How to solve this warning in render()?

Vue 3
Hello, can you tell me how to remove this warning:

Non-function value encountered for default slot. Prefer function slots for better performance.

// DeepL переводчик:
Нефункциональное значение, встречающееся для слота по умолчанию. 
Предпочтительные функциональные слоты для лучшей производительности

It happens because of a piece of code like this:
export default {
  render() {
    return [
      h('ul', this.$slots.default().map(slot => h('li', slot)))
    ]
  }
}

As I understand it, he suggests that I do something for better performance,
but I don’t understand what exactly

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Aetae, 2021-04-11
@Aetae

this.$scopedSlots

A
Andrew, 2021-11-03
@Shatge

In vue 3, scoped slots have been merged into slots.
Now we need to write $slots instead of $scopedSlots.
https://v3.vuejs.org/guide/migration/slots-unifica...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question