0.1.0 • Published 6 years ago

babel-plugin-react-create-element-require v0.1.0

Weekly downloads
346
License
MIT
Repository
github
Last release
6 years ago

babel-plugin-react-create-element-require

Build
Status npm

 

Babel plugin that adds react's createElement import declaration aliased as t out of convention.

_(this repo was cloned from styled-components-require and modified to match needs.

 

Example

Your component.js that contains this code:

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

will be transpiled to:

import { createElement as t } from 'react';

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

 

Usage

npm install babel-plugin-react-create-element-require --save-dev

Add react-create-element-require into .babelrc

{
  "plugins": ["react-create-element-require"]
}

 

You like?

:star: this repo

 

License

MIT © mciparelli