1.0.0 • Published 9 years ago

babel-utils-react v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

babel-utils-react

Utility functions for building Babel plugins for React code

Example

import reactUtilsFactory from 'babel-utils-react';

export default function ({Plugin, types: t}) {
  const reactUtils = reactUtilsFactory(t);

  return new Plugin('ast-transform', {
    visitor: {
      ClassDeclaration(node) {
        if (reactUtils.isReactComponentClassDeclaration(node)) {
          // Yay, a React.Component class!
        }
      }
    }
  });
}

Installation

$ npm install babel-utils-react