An open API service indexing awesome lists of open source software.

https://github.com/nickmessing/babel-plugin-jsx-vue-functional

JSX Syntactic Sugar Plugin for Vue Functional Components
https://github.com/nickmessing/babel-plugin-jsx-vue-functional

Last synced: 2 months ago
JSON representation

JSX Syntactic Sugar Plugin for Vue Functional Components

Awesome Lists containing this project

README

          

[![Build Status](https://travis-ci.org/nickmessing/babel-plugin-jsx-vue-functional.svg?branch=master)](https://travis-ci.org/nickmessing/babel-plugin-jsx-vue-functional)

## DEPRECATED: Check https://github.com/vuejs/jsx instead

## JSX Functional Components for Vue JSX

This babel plugin adds some syntactic sugar to JSX.

### Usage:

```bash
npm i babel-plugin-jsx-vue-functional -D
```
or
```bash
yarn add babel-plugin-jsx-vue-functional -D
```

Then add `jsx-vue-functional` to your `.babelrc` file under `plugins`

example .babelrc:
```json
{
"presets": ["es2015"],
"plugins": ["jsx-vue-functional", "transform-vue-jsx"]
}
```

Example:
```js
const A = () =>

Hello World


export const B = ({ props, listeners }) =>
{props.msg}

```
will be transpiled into:
```js
const A = {
functional: true,
render: (h) =>

Hello World


}

export const B = {
functional: true,
render: (h, { props, listeners }) =>

{props.msg}

}
```

#### Warning

This plugin will transform **all** named arrow functions that contain JSX and
starting with version 2.0.0 so this code will not work:
```js
const A = () =>

Hello World


export const B = ({ props, listeners }) =>
{props.msg}{A()}

```