react-docgen
react-docgen copied to clipboard
Dependency detection
Hi, wondered if it is possible to parse the jsx and obtain all Tag names (maybe exclude native tags) to form the dependency list for the component.
Cheers :)
This should be possible. You can define your own handler which traverse the AST of the render (and any other method you are interested in) and look for JSX elements.
Do you have a more specific about that?
Ic. I saw that there is the composes key in the output. Is that in used at the moment?
Yes. This is populated with the component names when you do
propTypes: {
...SomeOtherComponent.propTypes,
}
But if you want to add to that from your own handler, that's fine I guess. It's your code after all :)