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

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

Open
tusaeff opened this issue Nov 26, 2019 · 1 comment · May be fixed by #89
Open

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

tusaeff opened this issue Nov 26, 2019 · 1 comment · May be fixed by #89

Comments

@tusaeff
Copy link

tusaeff commented Nov 26, 2019

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
Copy link
Author

tusaeff commented Nov 26, 2019

i also opened pull request which fixes this

will be very grateful for the comments!

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

Successfully merging a pull request may close this issue.

1 participant