Possibility to use class-name property instead of className
See original GitHub issueThe problem
I created a tiny Emotion wrapper in ClojureScript. I’m going to open-source this wrapper but I have issue with className
property. In Clojure idiomatic to use kebab-case notation. So, it would be great to use prop class-name
in styled components instead of className
but unfortunately I don’t have any methods in emotion to change it.
Currently I have only one way, it’s wrap styled component to react.createElement
and convert className
to class-name
.
Proposed solution
It would be great to add this to options (somethings like shouldForwardProp
). For example,
{
classNameProp: 'class-name',
}
Link to this wrapper (WIP) https://github.com/khmelevskii/emotion-cljs
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:18 (8 by maintainers)
Top Results From Across the Web
Why React uses className over class attribute
Explanation: The only reason behind the fact that it uses className over class is that the class is a reserved keyword in JavaScript...
Read more >class vs className in React 16 - Stack Overflow
class is a keyword in javascript and JSX is an extension of javascript. That's the principal reason why React uses className instead of ......
Read more >Why you have to use className in React, but not in Preact?
The only reason behind the fact that it uses className over class is that the class is a reserved keyword in JavaScript and...
Read more >Why does React use className instead of a class attribute?
When applying CSS classes to all common DOM and SVG elements like buttons, li, a, and div in React, we use the className...
Read more >Why do I have to use 'className' instead of 'class' in ReactJs ...
Because it is parsed by JavaScript, and JavaScript treats certain words as special, a few attribute names in JSX are different (className instead...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ye, I understand that it’s more annoying with React components but it still is not enough of an argument for me to accept this change. I understand that this has not played out like you would have hoped and I’m sorry for that.
This looks like a suitable workaround.