react-docgen icon indicating copy to clipboard operation
react-docgen copied to clipboard

Dependency detection

Open khankuan opened this issue 9 years ago • 3 comments

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 :)

khankuan avatar Jun 07 '16 02:06 khankuan

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?

fkling avatar Jun 14 '16 22:06 fkling

Ic. I saw that there is the composes key in the output. Is that in used at the moment?

khankuan avatar Jun 14 '16 22:06 khankuan

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 :)

fkling avatar Jun 21 '16 19:06 fkling