Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.1.5+]Multiple root nodes from functional component render function not allowed now? #4472

Closed
Uriziel01 opened this issue Dec 13, 2016 · 4 comments

Comments

@Uriziel01
Copy link

Vue.js version

2.1.5, 2.1.6

Reproduction Link

[2.1.4] https://jsfiddle.net/uriziel01/kx1yuu3a/ [working]
[2.1.5] https://jsfiddle.net/uriziel01/kx1yuu3a/3/ [broken]

Steps to reproduce

Return array of elements from render function in functional component.

What is Expected?

Multiple root nodes seems to be dissallowed in Vue2 everywhere but not here.
I think that the correct solution would be to throw appropriate error to console and avoid returning undefined. Or is that designed logic and this should be handled by the engine as it was in older versions? You decide.

What is actually happening?

undefined is rendered as a result and no correct error is thrown to the console.

@eachmawzw
Copy link

I met the same problem, I want to use version 2.1.4, what should I do?

@Uriziel01
Copy link
Author

Uriziel01 commented Dec 14, 2016

Use 2.1.5+ versions and encapsule all the elements in additional parent like so:

return h('div', {}, [h('label', 'Test123'), h('label', 'Test123')];

Or just revert to 2.1.4 and wait to see what will happen with this Issue.

@eachmawzw
Copy link

The question has been decided.Thank you so much.

@Darkside73
Copy link

I use functional component as the only way to get rid of extraneous root component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants