Socket
Socket
Sign inDemoInstall

babel-plugin-jsx-kdu-functional

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-jsx-kdu-functional

JSX Syntactic Sugar Plugin for Kdu Functional Components


Version published
Weekly downloads
2
Maintainers
1
Install size
6.35 kB
Created
Weekly downloads
 

Readme

Source

JSX Functional Components for Kdu JSX

This babel plugin adds some syntactic sugar to JSX.

Usage:

npm i babel-plugin-jsx-kdu-functional -D

or

yarn add babel-plugin-jsx-kdu-functional -D

Then add jsx-kdu-functional to your .babelrc file under plugins

example .babelrc:

{
  "presets": ["es2015"],
  "plugins": ["jsx-kdu-functional", "transform-kdu-jsx"]
}

Example:

const A = () => <h1>Hello World</h1>
export const B = ({ props, listeners }) => <div onClick={listeners.click}>{props.msg}<A /></div>

will be transpiled into:

const A = {
  functional: true,
  render: (h) => <h1>Hello World</h1>
}

export const B = {
  functional: true,
  render: (h, { props, listeners }) => <div onClick={listeners.click}>{props.msg}<A /></div>
}

Warning

This plugin will transform all named arrow functions that contain JSX and starting with version 2.0.0 so this code will not work:

const A = () => <h1>Hello World</h1>
export const B = ({ props, listeners }) => <div onClick={listeners.click}>{props.msg}{A()}</div>

FAQs

Last updated on 13 Jul 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc