Skip to content

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

Open
@tusaeff

Description

@tusaeff

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions