Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including babel-plugin-transform-react-display-name with all npm packages installed. Try it out:

var babelPluginTransformReactDisplayName = require("babel-plugin-transform-react-display-name")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

babel-plugin-transform-react-display-name v6.25.0

Add displayName to React.createClass calls

babel-plugin-transform-react-display-name

Add displayName to createReactClass (and React.createClass) calls

Example

In

var foo = React.createClass({}); // React <= 15
var bar = createReactClass({});  // React 16+

Out

var foo = React.createClass({
  displayName: "foo"
}); // React <= 15
var bar = createReactClass({
  displayName: "bar"
}); // React 16+

Installation

npm install --save-dev babel-plugin-transform-react-display-name

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["transform-react-display-name"]
}

Via CLI

babel --plugins transform-react-display-name script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-react-display-name"]
});
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free