jsx-vue2 icon indicating copy to clipboard operation
jsx-vue2 copied to clipboard

babel-sugar-functional-vue: should transpile only functions returning JSX

Open tusaeff opened this issue 4 years ago • 1 comments

Hola! Recently, the team and I discovered a not very clear behavior We pass an object (best described as something like slots) with functions returning jsx to the function

const Wrapper = () => createPage({ 
    header: () => <header />,
    footer: () => <footer />,
    content: () => <content />,
})

but babel transpiles it into a functional component (something like sample below)

const Wrapper = {
  functional: true,
  render: (h) => createPage({ 
    header: () => <header />,
    footer: () => <footer />,
    content: () => <content />,
})
};

which poorly satisfies our requirements since createPage is not returning vnode

maybe I don’t fully understand all cases of babel-sugar-functional-vue usage (correct me if I'm wrong please), but I think that this is an undesirable behavior for all users, because the package documentation tells only about the transpilation of arrow functions which return JSX

tusaeff avatar Nov 26 '19 16:11 tusaeff