babel-plugin-react-docgen
Add propType doc to react classes
Installation
$ npm install @kadira/babel-plugin-react-docgen
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["@kadira/babel-plugin-react-docgen"]
}
Via CLI
$ babel --plugins @kadira/babel-plugin-react-docgen script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["@kadira/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. - Only works classes extended from
React.Component
with a render()
method. React.createClass
and stateless components are not supported yet.