react-docgen is a CLI and toolbox to help extracting information from React components, and generate documentation from it. It uses @babel/parser to parse the source into an AST and provides methods to process this AST to extract the desired information. The output / return value is a JSON blob / JavaScript object. It provides a default implementation for React components defined via React.createClass, ES2015 class definitions or functions (stateless components). These component definitions must follow certain guidelines in order to be analyzable. Installing the module adds a react-docgen executable which allows you to convert a single file, multiple files or an input stream. We are trying to make the executable as versatile as possible so that it can be integrated into many workflows. By default, react-docgen will look for the exported component created through React.createClass, a class definition or a function (stateless component) in each file.

Features

  • You can change that behavior with the --resolver option
  • Have a look at example/ for an example of how to use the result to generate a markdown version of the documentation
  • react-docgen will look for a babel configuration and use it if available
  • The tool can be used programmatically to extract component information and customize the extraction process
  • Locating/finding the nodes in the AST which define the component
  • Extracting information from nodes

Project Samples

Project Activity

See All Activity >

Categories

Documentation

License

MIT License

Follow react-docgen

react-docgen Web Site

Other Useful Business Software
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of react-docgen!

Additional Project Details

Programming Language

TypeScript

Related Categories

TypeScript Documentation Software

Registered

2022-09-07