vuejs / core

🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
https://vuejs.org/
MIT License
47.69k stars 8.33k forks source link

inject/provide does not work with createVNode and render #3220

Closed jsbroks closed 3 years ago

jsbroks commented 3 years ago

Version

3.0.5

Reproduction link

https://codesandbox.io/s/gifted-goldwasser-ysz0d

Steps to reproduce

  1. use provide in the parent component
  2. Render component to child element with createVNode and render
  3. The rendered component won't have access to inject

What is expected?

Access to injected values from parent

What is actually happening?

Inject result is always undefined.

posva commented 3 years ago

You shouldn't be using those functions manually. In general, if it doesn't appear in the documentation, you should avoid it

jsbroks commented 3 years ago

@posva How would you suggest rendering a component to an HTML element? (use case is for golden layout)