reactjs / reactjs/react-docgen
Handling prop defined in the argument list of stateless components
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 3.8k
- Fork
- 316
- Merge medio
- 5h 7m
- PR unite (30g)
- 4
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando il comportamento descritto in react-docgen issue #69 e la discussione collegata sulla deprecazione di defaultProps. Individua quindi il punto di ingresso per l’estrazione delle prop dei componenti e determina come vengono gestiti gli argomenti di funzione destrutturati. Il lavoro è completato quando i nomi delle prop richiesti e le informazioni sui tipi disponibili per questa sintassi sono documentati o supportati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, react
- Ambito
- documentation, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100