# babel-plugin-jsx-append-key-value

> A Babel plugin to append key value to specific react component from another library.

Latest version **0.1.9** (published 2022-08-06) · 0 weekly downloads

## Install

```sh
npm install babel-plugin-jsx-append-key-value
pnpm add babel-plugin-jsx-append-key-value
yarn add babel-plugin-jsx-append-key-value
bun add babel-plugin-jsx-append-key-value
```

## Health

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

Positive: has types; no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.9 |
| Published | 2022-08-06 |
| First published | 2022-07-31 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | undercoverj |

## Links

- npm: https://www.npmjs.com/package/babel-plugin-jsx-append-key-value
- Repository: https://github.com/UNDERCOVERj/babel-plugins
- Homepage: https://github.com/UNDERCOVERj/babel-plugins#readme
- Issues: https://github.com/UNDERCOVERj/babel-plugins/issues
- npm.io page: https://npm.io/package/babel-plugin-jsx-append-key-value

## Dependencies (1)

- [@babel/types](https://npm.io/package/@babel/types.md) ^7.18.9

## Recent versions

- 0.1.9 (latest) — 2022-08-06
- 0.1.1 (undefined) — 2022-07-31
- 0.1.8 — 2022-07-31
- 0.1.7 — 2022-07-31
- 0.1.6 — 2022-07-31
- 0.1.5 — 2022-07-31

## README

# babel-plugin-jsx-append-key-value

A Babel plugin to append key value to specific react component from another library.

## Usage

1. install

```
npm i babel-plugin-jsx-append-key-value -D

yarn add babel-plugin-jsx-append-key-value -D

pnpm i babel-plugin-jsx-append-key-value -D
```

2. Add to your .babelrc:

```
{
  plugins: [
    [
      'babel-plugin-jsx-append-key-value',
      {
        options: [
          {
            libraryName: 'antd',
            appendKvArray: [
              {
                componentName: 'Button',
                skipKeys: ['type', 'plain'],
                kvsMap: new Map([['plain', false]]),
              },
              {
                componentName: 'Switch',
                kvsMap: new Map([['checked', true]])
              }
            ],
          },
        ],
      }
    ]
  ],
}
```

## Example

- Before

```
import React from 'react';
import { Button, Switch } from 'antd';

export function Test() {
  return <div>
    <Button />
    <Button type='primary' />
    <Switch />
  </div>
}
```

- After

```
import React from 'react';
import { Button, Switch } from 'antd';
export function Test() {
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Button, {
    plain: false
  }), /*#__PURE__*/React.createElement(Button, {
    type: "primary"
  }), /*#__PURE__*/React.createElement(Switch, {
    checked: true
  }));
}
```

---
_Source: https://npm.io/package/babel-plugin-jsx-append-key-value · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
