How to do documentation in ReactJS?

We document our React components library by using React Styleguidist.

It will parse your code with the following features:

  • generate API / props docs from the PropTypes you define.
  • Create live editable examples documentation that lets people copy paste easily snippet.
  • It is pretty well configurable and has hot reload to achieve internal docs.

It works by building a web app through Webpack, that you can use locally or host somewhere for all your developers.

For us, it works pretty well and they improve it over time.

Edit: Is uses react-docgen under the hood.


Finally I found the solution, First go to the this link and read the document properly:- Read Document Now do the following steps:-

  • Open your command prompt
  • Install the JSDoc globally by command: npm install jsdoc -g
  • Now go to your project folder's path and run the command: jsdoc src -r -d docs
  • Above command will create the document in the doc folder of the your project directory.

    Try this package it has examples for you to understand.

    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 (see below for more info).

    https://www.npmjs.com/package/@rtsao/react-docgen