How document my react components with JSDoc
Introduction
It is necessary to have a good documentation about our components, so that other developers can understand how it works and how to use it. In this article we are going to see how we can document our react components with JSDoc and how to publish the documentation in our static site.
With a few simple steps, the jsdoc library and the use of good programming practices when working with react, we will be able to have a documentation of our components automatically. There are different plugins to upgrade our jsdoc and support react, but as React is still javascript and the components functions the default lib is more than enough.
The report we are going to generate is still an html file, so you can deploy it in any static site.
If you use typescript you will need to install jsdoc-babel
1. Installation
yarn add jsdoc-babel -D
2. Configuration
3. Customise your report
There you should find the code you need to modify your report and overwrite it.
4. Generate your report
yarn jsdoc -c jsdoc.json
To see an example of the output you can click above where it says Docs or via this link