Socket
Socket
Sign inDemoInstall

@ifaxity/hyper

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ifaxity/hyper

A modern hyperscript inspired library with IE9+ support.


Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source

@ifaxity/hyper

A modern hyperscript inspired library with IE9+ support.

Supports JSX and fragments, through this typescript config.

{
  "compilerOptions": {
    "target": "es5",
    "module": "es2015",
    "moduleResolution": "node",
    "lib": ["es5", "es6", "dom"],
    "jsx": "react",
    "jsxFactory": "h",
    "jsxFragmentFactory": "Fragment",
  }
}

And then in you code import the required members

import { h, Fragment, render } = from '@ifaxity/hyper';

function Button(props) {
  function onClick() {
    console.log('CLICKED');
  }

  return (
    <button onClick={props.onClick || onClick}>{props.children}</button>
  );
}

const app = (
  <>
    <h1>Click the button below</h1>
    <Button onClick={() => alert('CLICKED')}>Click me</Button>
  </>
);

render(app, '#app');

Dont want to use JSX? Thats fine.

Thats fine! You can use the tag shorthands (only for the most common tags) or the h factory directly.

import { h, button, render, fragment } = from '@ifaxity/hyper';

function Button(props) {
  function onClick() {
    console.log('CLICKED');
  }

  return button({ onClick: props.onClick || onClick }, props.children);
}

const app = fragment(
  h('h1#header'),
  h(Button, { onClick: () => alert('CLICKED') }, 'Click me')
);

render(app, '#app');

FAQs

Package last updated on 25 Oct 2020

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