Open trusktr opened 6 years ago
Seems like I'm doing things correctly, because if I modify my component from using aphrodite-jss,
import {StyleSheet, css} from 'aphrodite-jss'
import {Component} from 'react'
export default
class Foo extends Component {
render() {
return <div className={css(classes.footer)}>
<div className={css(classes.logoAndCopyright)} />
</div>
}
}
const classes = StyleSheet.create({
footer: {
// ...
'& $logoAndCopyright': {
// ...
},
},
logoAndCopyright: {},
})
to using plain JSS (from react-jss), then it works great:
import {jss} from 'react-jss'
import {Component} from 'react'
export default
class Foo extends Component {
render() {
return <div className={classes.footer}>
<div className={classes.logoAndCopyright} />
</div>
}
}
const {classes} = jss.createStyleSheet({
footer: {
// ...
'& $logoAndCopyright': {
// ...
},
},
logoAndCopyright: {},
}).attach()
So seems something isn't working in aphrodite-jss
.
I think the problem is the order of evaluation. The rules are lazily attached, which means the rules are only attached once css
is being called with them. The footer
rule is being attached before the logoAndCopyright
rule, which results in the warning.
I don't know if we can fix this. You can just call css(classes.logoAndCopyright)
before which should fix your problem.
Hmmm, that may be a strange caveat. It'd be nice to fix it. Well I've switched to react-jss because I was able to get that to work with SSR in the other thread, and to use aphrodite-jss I would have to solve the same problem again for aphrodite-jss.
As I see - it's old issue - but maybe somebody gonna looking for solution as I - to resolve this I moved style Initialization inside of component body
I've got some styles using jss-nested with
$classname
syntax:then when I use it,
I get an error like
Full output: