babel-plugin-react-create-element-require

Babel plugin that adds react's createElement import declaration

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
babel-plugin-react-create-element-require
100.1.05 years ago5 years agoMinified + gzip package size for babel-plugin-react-create-element-require in KB

Readme

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