@kadira/babel-plugin-react-docgen
v1.1.0
Published
Add propType doc to react classes
Readme
babel-plugin-react-docgen
Add propType doc to react classes
Installation
$ npm install babel-plugin-react-docgenUsage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["babel-plugin-react-docgen"]
}Via CLI
$ babel --plugins babel-plugin-react-docgen script.jsVia Node API
require("babel-core").transform("code", {
plugins: ["babel-plugin-react-docgen"]
});Guide
- React class information is avalable via
<ClassName>.__docgenInfoas a JSON parsabel string. - This plugin uses
react-docgenunder 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>"}]]