reactjs / reactjs/react-docgen

Stateless function components without React.createElement or JSX?

Aperta
#70 4 commenti 7 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
TypeScript
Stelle
3.8k
Fork
316
Merge medio
5h 7m
PR unite (30g)
4

Descrizione

react-docgen is unable to find stateless function components that don't contain JSX or React.createElement call expressions.

This might be the case when some helper library is used. This will also fail if the official React.DOM helpers are used (https://github.com/reactjs/react-docgen/pull/71). Another failing case would be if only React components are returned, but React.createElement was never called because the components were wrapped in React.createFactory.

What about adding support for another heuristic, such as having a propTypes property (and to be even more specific, a propTypes property with an object containing React.PropTypes entries).

I'm happy to implement this and add tests if this sounds reasonable to the maintainers.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia tracciando il rilevamento esistente dei componenti funzionali stateless in react-docgen e rivedendo i test per i componenti che usano React.createElement. Confronta l’euristica propTypes proposta con gli helper React.DOM e i casi React.createFactory; il lavoro è completato quando questi componenti vengono rilevati senza compromettere il comportamento di rilevamento esistente e i test coprono i pattern supportati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
react, typescript
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.