Dynamically generated classes ignored
See original GitHub issueI am trying to have a dynamic list of items and give each a sequentially calculated class, a spinner where I can just say the number of parts and they will be spaced automatically. This is partial code without the whole animation CSS:
const styles = theme => ({
letters: {
position: 'absolute'
},
letter: getLetterClasses(5),
'letter-0': { left: 50 }
})
const getLetterClasses = (number) => {
let list = {}
for (let i = 0; i < number; i++) {
list[`&-${i}`] = { left: 20 * i }
}
return list
}
//=============
const spinner = spinner_array.map((letter, i) => {
const cls = classnames(classes.letters, classes[`letter-${i}`])
return <div className={cls} key={i}>{letter}</div>
})
This only works when I create each class explicitly, like letter-0
, but ignores the dynamic part. I have no idea why since the object generation seems to work correctly.
https://codesandbox.io/s/30w6l0v786
- jss: 8.6.1
- Chrome 69
- macOS Mojave
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
React and Tailwind CSS: dynamically generated classes are ...
Tailwind's JIT mode scans your codebase for class names, and generates CSS based on what it finds. If a class name is not...
Read more >Use Dynamically Generated Classes as Mixins #1399 - GitHub
It would ignore returned from calls after its definition. So this: #outer { // enclosure around original case @a: "a"; .mixin() { @a:...
Read more >How to map a class with dynamically generated class in ...
I have generated new dynamic class which can hold customer and its custom fields as properties instead of collections like:.
Read more >Ignored classes could not be matched to its original source file
Ignored classes could not be matched to its original source file ... It might be a dynamically generated class.
Read more >Assigning FileNet P8 classes or properties dynamically - IBM
Assigning properties dynamically allows you to work with properties that might not be present in all dynamically assigned document and record classes. About ......
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
Your problem is not with JSS, but with how you use the classes. I fixed your class name concatentation https://codesandbox.io/s/k3nj04j9po
https://codesandbox.io/s/r70674owo4