Search code examples
javascriptreactjsjsdoc

How to do documentation in ReactJS?


I have a requirement to create the doc file of each of the component we define in our reactjs application. I am looking for the npm that we can use for creating the document of any extension, so that it may extract the code, comment everything from my component and change that to the document of any extension. How can I do that, please, assist me? My question is different from the other question found regarding the jsdoc, because I am looking for the documentation in reactjs using jsdoc.


Solution

  • Finally, I found a tool that solves this problem: JSDoc.app

    JSDoc 3 is an API documentation generator for JavaScript, similar to Javadoc or phpDocumentor. You add documentation comments directly to your source code, right alongside the code itself. The JSDoc tool will scan your source code and generate an HTML documentation website for you.

    After reading their setup instructions, I was able to 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

    This created the HTML documentation in the out/ folder of the project directory.