babel-stateless-jsx
v0.1.0
Published
Babel plugin for stateless jsx files
Readme
React stateless component plugin
This gives the ability to write pure JSX for stateless components, eliminating all the boilerplate needed to write one. Only writing JSX in a file is enough to define a stateless component:
<div> Hello {this.props.name}! </div>Using the .html.jsx extension can be a way to highlight the files containing stateless components written in pure JSX
See example folder for an example of usage.
Features
- Access
props. Eg.:<div> Hello {this.props.name}! </div> - Use of other components. Using asttribute
__jsxpathto reference where the component is from Eg.:<div><Konnichiwa __jsxpath="./japanese" name="World"/></div>
Instalation
npm install babel-stateless-jsxUsage
The plugin needs to be added alongside other plugins and presets. An example of how to set it up in package.json is below:
"babel": {
"presets": [
"babel-preset-env",
"babel-preset-react"
],
"plugins": [
"babel-stateless-jsx"
]
}