reactjs / reactjs/react-docgen
Handling prop defined in the argument list of stateless components
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.8k
- Forks
- 316
- Ø Merge
- 5 Std. 7 Min.
- Gemergte PRs (30 T.)
- 4
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das in react-docgen issue #69 beschriebene Verhalten und die verknüpfte Diskussion über die Abkündigung von defaultProps zu prüfen. Suche dann den Einstiegspunkt für die Extraktion von Component-Props und ermittle, wie destrukturierte Funktionsargumente behandelt werden. Erledigt ist die Aufgabe, wenn die für diese Syntax angeforderten Prop-Namen und verfügbaren Typinformationen dokumentiert oder unterstützt werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, react
- Bereich
- documentation, tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100