react-docgen
react-docgen copied to clipboard
Handling prop defined in the argument list of stateless components
Dear all,
I'm struggling to find documentation about handling a case in which you're defining props in the arguments passed to a stateless, functional component, i.e. ES6 destructuring assignment syntax. An example:
const SomeComponent = ({ propA, propB, propC = 'someString', propD = false}) => {}
The most similar to what I'm looking for is https://github.com/reactjs/react-docgen/issues/69.
Now, docgen returns a list of props-defined-as-arguments as long as they have a default value specified, the rest is straight ignored.
My question: is some work being done on this? Any documentation I can find in this regard?
It seems fair and logical that it's hard to infer anything (but the name) from those props that have no explicit default value attributed to them, but as it stands even the types of the props that are initiated in the arguments, are omitted. You just get a stringified value for whatever is passed to them.
Thanks in advance!
Edit: tapped into the discussion on deprecating defaultProps -- https://github.com/reactjs/rfcs/pull/107#issuecomment-644582699