babel-plugin-jsx-vue-functional
babel-plugin-jsx-vue-functional copied to clipboard
Allow to pass props as first argument
TypeScript supposes first argument of functional component is props.
https://www.typescriptlang.org/docs/handbook/jsx.html#stateless-functional-component
It would be nice if some option will be added that treats first argument as props.
Example:
const A = (props: { msg: string }, { listeners }) => <div onClick={listeners.click}>{props.msg}</div>;
will be transpiled into
const A = {
functional: true,
render: (h, ctx) => (
(props, { listeners }) => <div onClick={listeners.click}>{props.msg}</div>
)(ctx.props, ctx)
}