# @kdujs/babel-sugar-k-on

> Babel syntactic sugar for k-model support in Kdu JSX

Latest version **1.4.0** (published 2023-07-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @kdujs/babel-sugar-k-on
pnpm add @kdujs/babel-sugar-k-on
yarn add @kdujs/babel-sugar-k-on
bun add @kdujs/babel-sugar-k-on
```

## 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.4.0 |
| Published | 2023-07-29 |
| First published | 2022-07-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | NKDuy |
| Maintainers | nkduy |

## Links

- npm: https://www.npmjs.com/package/@kdujs/babel-sugar-k-on
- Repository: https://github.com/kdujs/jsx.git#main
- Homepage: https://github.com/kdujs/jsx/tree/main#readme
- Issues: https://github.com/kdujs/jsx/issues
- npm.io page: https://npm.io/package/@kdujs/babel-sugar-k-on

## Dependencies (3)

- [camelcase](https://npm.io/package/camelcase.md) ^5.0.0
- [@babel/plugin-syntax-jsx](https://npm.io/package/@babel/plugin-syntax-jsx.md) ^7.2.0
- [@kdujs/babel-plugin-transform-kdu-jsx](https://npm.io/package/@kdujs/babel-plugin-transform-kdu-jsx.md) ^1.4.0

## Recent versions

- 1.4.0 (latest) — 2023-07-29
- 1.2.4 — 2022-12-30
- 1.1.3 — 2022-12-17
- 1.0.1 — 2022-12-15
- 1.1.2 — 2022-07-24

## README

## @kdujs/babel-sugar-k-on

Syntactic sugar for k-on in JSX.

### Usage

Install the dependencies:

```sh
# for yarn:
yarn add @kdujs/babel-sugar-k-on
# for npm:
npm install @kdujs/babel-sugar-k-on --save
```

In your `.babelrc`:

```json
{
  "plugins": ["@kdujs/babel-sugar-k-on"]
}
```

However it is recommended to use the [configurable preset](../babel-preset-jsx/README.md) instead.

### Details

This plugin adds k-on to the JSX and tries to mirror the same behaviour as in kdu-template-compiler, with a few differences:

1.  You should use underscore (`_`) instead of dot (`.`) for modifiers (`kOn:click_prevent={this.test}`)
2.  It is recommended to use camelCase version of it (`kOn`) in JSX, but you can use kebab-case too (`k-on`).

```js
export default {
  methods: {
    test() {
      console.log('Hello World')
    },
  },
  render(h) {
    return (
      <div>
        <a href="https://kdu-js.web.app" kOn:click={this.test}>Kdu</a>
      </div>
    )
  },
}
```

---
_Source: https://npm.io/package/@kdujs/babel-sugar-k-on · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
