gajus / gajus/babel-plugin-react-css-modules
`createElement` and `cloneElement`
- Lenguaje dominante
- JavaScript
- Estrellas
- 2k
- Forks
- 159
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza localizando cómo el plugin gestiona styleName y las pruebas existentes para las transformaciones de JSX. Investiga cómo React.createElement y React.cloneElement reciben props y, a continuación, define pruebas que demuestren que ambas APIs transforman styleName sin dejarlo en el elemento DOM.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- babel, javascript, react
- Área
- frontend, tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 30/100