[Vue warn]: Multiple root nodes returned from render function. Render function should return a single root node.
See original GitHub issueWhen having a construct like this for a component, I get the following error due to the reason that the funcational component returns actually two elements.
<template>
<no-ssr>
lalala
</no-ssr>
</template>
Error I get: [Vue warn]: Multiple root nodes returned from render function. Render function should return a single root node.
I guess it has somethign todo with the return value of the render function:
return h(
props.placeholderTag,
{
class: ['no-ssr-placeholder']
},
props.placeholder || placeholderSlot
)
How can I ensure that in this case there is actually only one element returned (I don’t need a placeholder)
Thanks Simon
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:7 (4 by maintainers)
Top Results From Across the Web
"Multiple root nodes returned from render function" error with ...
"Multiple root nodes returned from render function. Render function should return a single root node." error in console, nothing render.
Read more >Error in vue.js (Multiple root nodes returned from render ...
Your createComponent returns an array of VNodes on line 9 . It seems that you are always passing an array of node definitions...
Read more >Error: Multiple root nodes returned from render function. from v ...
If that slot contains multiple items then they'll all be returned, leading to the error you're seeing. Try wrapping the two nodes in...
Read more >Can A Vue Template Have Multiple Root Nodes (Fragments)?
Rendering a list of child nodes in a component is not a design pattern that works with Vue due to the single root...
Read more >Can a Vue Template Have Multiple Root Nodes (Fragments)?
You'll get a compilation and/or runtime error, as templates must have a single root element. Typically, you'll fix this problem by adding a ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
<no-ssr>
renders the default slot which is an array when mounted:https://github.com/egoist/vue-no-ssr/blob/f9b6f194121b4937bed4846b9fbc8f01fd06e75b/src/index.js#L14-L16
so you can’t use this component at root level, instead:
@Yimiprod the docs didn’t say that
update: well it did, but that has been removed since 1.0