π«Nested selectors (ex $ syntax)
tss-react unlike jss-react doesn't support the $ syntax but a better alternative.
makeStyles
makeStylesIn JSS you can do:
//WARNIG: This is legacy JSS code!
{
"parent": {
"padding": 30,
"&:hover $child": {
"backgroundColor": "red"
},
},
"child": {
"backgroundColor": "blue"
}
}
//...
<div className={classes.parent}>
<div className={classes.child}>
Background turns red when the mouse is hover the parent
</div>
</div>
This is how you would achieve the same result with tss-react
An other example:
WARNING: Nested selectors requires ES6 Proxy support which IE doesn't support. It can't be polyfilled (this will not work) but don't worry, if
Proxyis not available on a particular browser, no error will be thrown and TSS will still do its work. Only nested selectors won't work.
withStyles
withStylesSSR
With server side rendering enabled you could end up with warnings like:
Warning: Prop className did not match. Server: "tss-XXX-root-ref" Client: "tss-YYY-root-ref".

You can fix this error by providing an uniq id when calling makeStyles or withStyles (It will set XXX and YYY).
Last updated
Was this helpful?