I'm experimenting with JSS to see if it is realistic to migrate a Sass code base. I have a very basic example of a CSS style that, when hovered, modifies the style of a child node.
span {
color: red;
}
button:hover span {
color: blue;
}
<button>
<span>Click Me</span>
</button>
I am unsure how to write this in JSS. Something I have tried looks like:
const styles = {
button: {
'&:hover': {
span: {
color: 'blue',
}
}
},
span: {
color: 'red',
}
}
const { classes } = jss.createStyleSheet(styles).attach()
document.body.innerHTML = `
<button class=${classes.button}>
<span class=${classes.span}>Click Here</span>
</button>
`
Thanks!
someClass
. – Titanomachy