Reputation: 83
I am looking for the best practices while documenting code in JavaScript or React components. What is out there that can be considered as "nice tools/libraries" while documenting? Thanks.
Upvotes: 4
Views: 4294
Reputation: 781
For JavaScript during a long time and still used currently there is JSdoc3.
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.
But it looks like the support on this repository looks dead currently but it's still used by a lot of people.
Other alternatives there is :
YUIDoc is a Node.js application that generates API documentation from comments in source, using a syntax similar to tools like Javadoc and Doxygen.
Inline Documentation for RESTful web APIs apiDoc creates a documentation from API annotations in your source code.
Now if you are looking for something more integrated with React/Components and a playground where users can play around with and view live code there is other choices (more oriented UI Components) :
Isolated React component development environment with a living style guide
Storybook is a UI development environment and playground for UI components. The tool enables users to create components independently and showcase components interactively in an isolated development environment.
Today, tools that allow us to be quick and effective in what we are doing are really necessary. We can't afford to lose time with tasks that should be trivial. This is why docz was created.
Docz and Styleguidist both have a playgrounds where users can play around with and view live code and automatic proptables that read out component proptypes. Documentation are written in MDX file for the first one and simple markdown for the second. Docz may be the easiest one to use but they can all fit your needs.
For Storybook I know it's a great tool but I never used it so I can tell you more about it.
JSDocs could also be used for documenting components but without interactive state.
Upvotes: 6