# @minar-kotonoha/babel-plugin-react-directives

> A babel plugin that provides some directives for react(any JSX), similar to directive of vue.

Latest version **1.2.3** (published 2020-11-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @minar-kotonoha/babel-plugin-react-directives
pnpm add @minar-kotonoha/babel-plugin-react-directives
yarn add @minar-kotonoha/babel-plugin-react-directives
bun add @minar-kotonoha/babel-plugin-react-directives
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.3 |
| Published | 2020-11-17 |
| First published | 2020-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 7 |
| Unpacked size | 47.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | chengzhuo5 |
| Maintainers | chengzhuo5 |
| Keywords | babel-plugin, react-directive, jsx-directive, jsx-plus, directive, react, vue, x-if, x-for, v-if, v-for |

## Links

- npm: https://www.npmjs.com/package/@minar-kotonoha/babel-plugin-react-directives
- Repository: https://github.com/chengzhuo5/babel-plugin-react-directives
- Homepage: https://github.com/chengzhuo5/babel-plugin-react-directives#readme
- Issues: https://github.com/chengzhuo5/babel-plugin-react-directives/issues
- npm.io page: https://npm.io/package/@minar-kotonoha/babel-plugin-react-directives

## Dependencies (7)

- [ajv](https://npm.io/package/ajv.md) ^6.12.4
- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [semver](https://npm.io/package/semver.md) ^6.3.0
- [ajv-errors](https://npm.io/package/ajv-errors.md) ^1.0.1
- [@babel/types](https://npm.io/package/@babel/types.md) ^7.11.5
- [@babel/generator](https://npm.io/package/@babel/generator.md) ^7.11.6
- [@babel/code-frame](https://npm.io/package/@babel/code-frame.md) ^7.10.4

## 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

- 1.2.3 (latest) — 2020-11-17
- 1.2.2 — 2020-11-16
- 1.2.1 — 2020-11-15
- 1.2.0 — 2020-11-15

## README

# @minar-kotonoha/babel-plugin-react-directives

原 git 项目：https://github.com/peakchen90/babel-plugin-react-directives/

本项目是基于原项目的二次开发，配合[@minar-kotonoha/vue-native-core](https://github.com/chengzhuo5/vue-native-core)支持了 v-model 指令。原项目针对 class 组件的 v-model 指令重命名为 v-model-class。

如果不使用@minar-kotonoha/vue-native-core，此项目也能正常运行。

## 使用说明

```javascript
// babel.config.js
{
  plugins: [
    [
      "@minar-kotonoha/babel-plugin-react-directives",
      {
        prefix: "v",
        pragmaType: "React"
      }
    ]
  ];
}
```

```javascript
// Vue组件
import React from "react";
import { constructor } from "@minar-kotonoha/vue-native-core";

export default constructor({
  data() {
    return {
      input: "hhh"
    };
  },
  render() {
    return (
      <div>
        <div>{this.input}</div>
        <input v-model={this.input} />
      </div>
    );
  }
});
```

```javascript
// React-class组件
import React, { Component } from "react";
class Test extends Component {
  state = { data: "" };
  render() {
    return (
      <div>
        <div>{this.state.data}</div>
        <input v-model-class={this.state.data} />
      </div>
    );
  }
}
```

---
_Source: https://npm.io/package/@minar-kotonoha/babel-plugin-react-directives · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
