Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

Stateless components #36

Closed
wants to merge 2 commits into from

Conversation

iamdustan
Copy link

Detect and wrap stateless function components.

@iamdustan iamdustan force-pushed the stateless-components branch 2 times, most recently from eded4ad to eb8d1bf Compare October 6, 2015 17:47
if (!node.arguments) {
// likely stateless function component. Check if assigned to a variable
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

threading the parent node through to here so that the following example resolves a displayName of MyComponent

const MyComponent = (props) => <div />

},
_$factory: {
displayName: "factory",
isInFunction: true
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not certain if all of these are actually correct; I suspect not, though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e.g.

const MyComp = (props) => <div />;

probably should not be marked as isInFunction, correct?

@iamdustan
Copy link
Author

Oh shucks, I just saw #34 and the reference to react-proxy@react-0.14. Whoops :)

@iamdustan iamdustan closed this Oct 6, 2015
@joshblack
Copy link
Collaborator

@iamdustan if you have time, would love some review on some of the changes I made! Have just been doing what I can to make the test cases pass or generate new ones for edge cases.

@iamdustan
Copy link
Author

:) @joshblack I’ve just been adding support for these things to another project. reactjs/react-docgen#28. Divide and conquer!

@iamdustan
Copy link
Author

I’m kind of biased towards not supporting edge cases and guiding folks down the preferred path.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants