Self-documenting your React Components

Since the release of react-docgen I thought in the idea of having a simple tool runnable through npm run-script to automatically update the README with the component documentation extracted with react-docgen.

That way, when authoring UI components built with React, you don’t need to care about keeping the README in sync with the Component code. Setting up a npm prepublish hook or a git pre-commit hook you could have the documentation automatically generated every time you publish a new version or before commiting any code change.

So, last weekend I wrote a tool to do just that, it’s named react-docgen-readme.

Obviously, having documentation in the README makes a lot of sense for small UI components. But if you want to document a whole application built with React, or to have something more visual, you probably want to build your own thing on the top of react-docgen or use some tool in-progress like react-docgen-ui.

comments powered by Disqus