Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-react-hyperscript

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-react-hyperscript

HyperScript syntax for React components without runtime overhead

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

babel-plugin-react-hyperscript

npm

HyperScript syntax for React components without runtime overhead.

Compiles react-hyperscript into React.createElement.

Example

Input

h('h1#boom.whatever.foo', [
  h('span'),
  h(MyComponent, { text: 'Hello!' })
]);

Output

React.createElement('h1', {
  id: 'boom',
  className: 'whatever foo'
},
React.createElement('span'),
React.createElement(MyComponent, { text: 'Hello!' }));

Installation

npm i babel-plugin-react-hyperscript

Plugin options

pragma

By default calls to h will be replaced with React.createElement, but you can override this with a custom pragma (including h itself when used with Preact).

{
  "plugins": ["react-hyperscript", { "pragma": "yo" }]
}
// Input
h('h1#boom.whatever.foo', [
  h('span'),
  h(MyComponent, { text: 'Hello!' })
]);

// Output
yo('h1', {
  id: 'boom',
  className: 'whatever foo'
},
yo('span'),
yo(MyComponent, { text: 'Hello!' }));

Usage

.babelrc

{
  "plugins": ["react-hyperscript"]
}

Via CLI

babel --plugins react-hyperscript script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["react-hyperscript"]
});

License

MIT

Keywords

FAQs

Package last updated on 28 Jul 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc