G
G
GizzaProger2020-03-01 11:54:40
Vue.js
GizzaProger, 2020-03-01 11:54:40

Why is this == undefined in vuejs functional component?

Good day.
I am making a functional vue.js component. You need to get the this context to call the slots of the component, but this is not defined in my opinion, not only in the render function, but in the entire component. How to fix it and what is it connected with?

export default {
    functional: true,
    render(h) {
        console.log(this)
        return h("div", "DFFG")
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-03-01
@GizzaProger

Because they are designed like this :

we can mark components as functional (option functional), which means they have no state (no reactive data ) and no instance (no context variable this)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question