Wrap new component code with fragment only if needed
chiptus opened this issue · comments
Thank you for this extension, for a long time I wanted one like this (I started creating one, but didn't have the time to make it more production ready).
Now for the bug/feature-request:
Not always I will need a fragment (<>
) wrapping my new component. It should wrap only when there's more than one element in the root
@chiptus Glad you liked it! Thank you! As for the idea - I agree completely!
The problem here is that Babel doesnt know how to parse multiline JSX, and throws an error. Thats why I wrap it by default.
The naive solution would be to have a try-catch statement, with a fallback in the catch statement. But that pretty bad.