gajus / gajus/babel-plugin-react-css-modules
`createElement` and `cloneElement`
- Lingua principale
- JavaScript
- Stelle
- 2k
- Fork
- 159
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
There is currently no support for using `createElement` and `cloneElement` with the `styleName` attribute (as far as I've tried), which at times can be a bit painful.
```jsx
render() {
const element = ordered ? 'ol' : 'ul';
return React.createElement(
element,
{
styleName: 'example-style', // <-- This
},
);
}
```
-->
```
Warning: React does not recognize the `styleName` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `stylename` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
```
I haven't read through the source code but t would assume it is a transform thing, where the `styleName` prop is not read as it's not a JSX prop but rather a passed in as an object. JSX gets transformed into `createElement`s so I would've guessed that this would work automatically but I guess not, unless I'm doing something wrong here.
Wondering if there's any ability for future support?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia individuando la gestione di styleName da parte del plugin e i test esistenti per le trasformazioni JSX. Esamina come React.createElement e React.cloneElement ricevono le props, quindi definisci test che dimostrino che entrambe le API trasformano styleName senza lasciarlo sull'elemento DOM.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- babel, javascript, react
- Ambito
- frontend, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 30/100