Skip to content

mmircea16/babel-stateless-jsx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 __jsxpath to reference where the component is from Eg.: <div><Konnichiwa __jsxpath="./japanese" name="World"/></div>

Instalation

npm install babel-stateless-jsx

Usage

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"
    ]
  }

About

A babel plugin for stateless jsx files

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published