@andrewn/babel-plugin-transform-react-stateless-component-name

1.0.0 • Public • Published

babel-plugin-transform-react-stateless-component-name

Build Status npm Codecov.io

Adds a display name to the stateless component in the React Dev Tools.

Example

// App.jsx
import React from 'react';

export default () => (
  <h1>Hello World!</h1>
);

// index.js
import App from './App'
import React from 'react';
import { render } from 'react-dom';

render(<App />, document.getElementById('root'));

Before

Before

After

After

Installation

$ npm install babel-plugin-transform-react-stateless-component-name

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-react-stateless-component-name"]
}

Via CLI

$ babel --plugins transform-react-stateless-component-name script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-react-stateless-component-name"]
});

License

Copyright © 2015 Neil Kistner

Released under the MIT license. See license for details.

Package Sidebar

Install

npm i @andrewn/babel-plugin-transform-react-stateless-component-name

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • andrewn