Subscribe on changes!

Get a warning "Invalid vnode type" when creating component

avatar
Aug 28th 2020

Version

3.0.0-rc.9

Reproduction link

https://jsfiddle.net/uns8xvpt/

Steps to reproduce

Open the jsfiddle and see the console

What is expected?

I use render function and I am trying to create a comment The documentation says that I can use null as a value of the argument https://v3.vuejs.org/api/global-api.html#arguments-2

What is actually happening?

I get the warning [Vue warn]: Invalid vnode type when creating vnode: null.

avatar
Aug 28th 2020

Use createCommentVNode() instead.

avatar
Aug 28th 2020

@HcySunYang I can't find it in docs. Is it a global API? Why can't I use h function?

avatar
Aug 28th 2020

You can also return null directly

avatar
Aug 28th 2020

@HcySunYang yes. It works. Thanks! But why do I get the warning with h function?

avatar
Aug 28th 2020

h does not accept null. Also don't use createCommentVNode, that's internal.

Just return null.

avatar
Sep 14th 2020

@yyx990803 I see in the documentation that I can use null as a type