babel-plugin-transform-expressive-react
Babel plugin for transforming
do{ }
statements into React compatable markup. Most comperable to babel-plugin-transform-react-jsx, simply furnishing a different paradigm. May be used along size JSX and it's respective babel-plugins, or used as a feature-complete replacement, depending on your needs.
Install
npm install babel-preset-expressive-react
.babelrc
{
"plugins": [
"expressive-react"
]
}
Entry Points
babel-plugin-transform-expressive-react will enter context upon encountering the DoExpression e.g.
do{}
in various contexts. It will also do so for any method with the name "do" e.g.do(){}
For more information on actual syntax, consult the main repo.
Element Expressions
let element = do ; //equivalent to in JSX let element = <div></div> //outputs let element = React
Arrow Components
let do div `Hello `; //equivalent to in JSX let <div>Hello propsto</div> //outputs let { return React}
Do Component Method
Component doprops //equivalent to in JSX Component { var props = this; return <SayHi to="World" /> }
Disclaimer
This plugin will conflict with babel-plugin-do-expressions. Make sure your project is not using it or the following presets as they do inherit this plugin.