# babel-plugin-component-name-as-jsx-prop

> Add property to render with component name

Latest version **0.0.5** (published 2018-11-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-plugin-component-name-as-jsx-prop
pnpm add babel-plugin-component-name-as-jsx-prop
yarn add babel-plugin-component-name-as-jsx-prop
bun add babel-plugin-component-name-as-jsx-prop
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2018-11-21 |
| First published | 2018-02-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | hhhonzik |
| Keywords | babel, babel-plugin, react, jsx, propTypes |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-component-name-as-jsx-prop
- npm.io page: https://npm.io/package/babel-plugin-component-name-as-jsx-prop

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [babel-types](https://npm.io/package/babel-types.md) ^6.26.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2018-11-21
- 0.0.4 — 2018-11-21
- 0.0.3 — 2018-11-21
- 0.0.2 — 2018-02-15
- 0.0.1 — 2018-02-14

## README

# babel-plugin-component-name-as-jsx-prop

Add a description for the plugin here

## Example

**In**

```js
import React, { Component } from 'react';

class MyComponent extends Component {
  render() {
    return <div someOtherAttribute/>;
  }
}


function Example() {
  return (
    <div>
      <p />
    </div>
  );
}

const Example = () => {
  return <div />;
};
```

**Out**

```js
import React, { Component } from 'react';

class MyComponent extends Component {
  render() {
    return <div data-name="MyComponent" someOtherAttribute />;
  }
}

function Example() {
  return <div data-name="Example">
      <p />
    </div>;
}

const Example = () => {
  return <div data-name="Example" />;
};
```

## Installation

```sh
$ npm install babel-plugin-component-name-as-jsx-prop
```

## Usage

### Via `.babelrc` (Recommended)

**.babelrc**

```json
{
  "plugins": ["component-name-as-jsx-prop"]
}
```

### Via CLI

```sh
$ babel --plugins component-name-as-jsx-prop script.js
```

### Via Node API

```javascript
require("babel-core").transform("code", {
  plugins: ["component-name-as-jsx-prop"]
});
```



## Credits

Boilerplate and some code is from those 2 plugins:

- https://github.com/layershifter/babel-plugin-transform-react-handled-props
- https://github.com/alanbsmith/babel-plugin-react-add-property

## License

**MIT**

---
_Source: https://npm.io/package/babel-plugin-component-name-as-jsx-prop · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
