Skip to content

mciparelli/babel-plugin-react-hyperscript-require

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-react-hyperscript-require

Build Status npm

 

Babel plugin that adds react-hyperscript import declaration

(this repo was cloned from styled-components-require and modified to be used with react-hyperscript)

 

Example

Your component.js that contains this code:

const Component = h('div', 'hello world');
export default Component;

will be transpiled to:

import h from 'react-hyperscript';

const Component = h('div', 'hello world');
export default Component;

 

Usage

npm install babel-plugin-react-hyperscript-require --save-dev

Add react-hyperscript-require into .babelrc

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

 

Tests

✓ add import statement if h() is present

✓ do not add when no h in use

✓ do not add import react-hyperscript twice

✓ do not add if it already imported

 

You like?

⭐ this repo

 

License

MIT © mciparelli

About

Babel plugin that adds react-hyperscript import declaration

Resources

License

Stars

Watchers

Forks

Packages

No packages published