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

You Might Also Like
Gen AI apps are built with MongoDB Atlas Icon
Gen AI apps are built with MongoDB Atlas

Build gen AI apps with an all-in-one modern database: MongoDB Atlas

MongoDB Atlas provides built-in vector search and a flexible document model so developers can build, scale, and run gen AI apps without stitching together multiple databases. From LLM integration to semantic search, Atlas simplifies your AI architecture—and it’s free to get started.
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