1.1.0 • Published 8 years ago

@kadira/babel-plugin-react-docgen v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

babel-plugin-react-docgen

Add propType doc to react classes

Installation

$ npm install babel-plugin-react-docgen

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["babel-plugin-react-docgen"]
}

Via CLI

$ babel --plugins babel-plugin-react-docgen script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["babel-plugin-react-docgen"]
});

Guide

  • React class information is avalable via <ClassName>.__docgenInfo as a JSON parsabel string.
  • This plugin uses react-docgen under the hood, so every limitation it has, applies.
  • If you need a global object with all the react component docs, set plugin options like this in .babelrc (replace with variable name you want)
"plugins":[["babel-plugin-react-docgen", {"DOC_GEN_GLOBAL": "<your global name>"}]]