6.22.1 • Published 7 years ago

babel-plugin-transform-jsx-arrow v6.22.1

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
7 years ago

babel-plugin-transform-jsx-arrow

wrap jsx expression to ()=> expr

annotate jsx file @jsx-arrow ( param, param )- param list used in arrow

Example

In

/* @jsx vdom */
/* @jsx-arrow(m) */
<div id={m.id}> {m.id} </div>

Out

the same as

<div id={(m) => m.id}> {(m) => m.id} </div>

or

vdom('div', {
		id : function(m) { return m.id }
	},
	function(m) { return m.id }
	)

Installation

npm install --save-dev babel-plugin-transform-jsx-arrow

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["babel-plugin-transform-jsx-arrow"]
}

Via CLI

babel --plugins babel-plugin-transform-jsx-arrow script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["babel-plugin-transform-jsx-arrow"]
});