Hey guys, in this video we'll unpack styling in JSS which, as a reminder, is a popular CSS-in-JS library. Although inline styles in React are superior to external stylesheets in that they don't require a toolchain dependency (e.g. Webpack loaders) and retain a scoped namespace, they come at the cost of decreased performance, as well as advanced CSS features (media queries, pseudo selectors, etc.).
CSS-in-JSS addresses the problems inherent in both global CSS and inline styles. JSS, in particular, stands out among others (CSS modules, Aphrodite, Fela, etc.) with its clean & consistent API, low bundle size, SSR support, plugin extensions, and easy debugging. For detailed info I suggest you visit the official site http://cssinjs.org and http://cssinjs.org/react-jss
Technically, MUI allows for any third-party styling solution other than JSS, especially if your project is already boxed in an alternative setup; in fact, they describe how you can go about integrating e.g. Styled Components in the Interoperability secion https://material-ui-next.com/guides/interoperability/ However, JSS is already built into MUI, as it forks react-jss internally, so why not give it a try? Chances are, you'll love it!
And plus, with CSS-in-JSS, not only do you have full power of CSS, but you also get things like autoprefixing for free. Besides, dynamic styling (at runtime) and nested theming with overwrites will feel like a breeze. We'll take a closer look at themes in the very next episode, but for now, be sure to experiment with withStyles() helper from material-ui. Note that withStyles HOC can also be used as a decorator @ (though it's not supported in create-react-app out of the box, so you'll have to eject or fork https://www.youtube.com/watch?v=I22TW-33dDE)
Tabs cannot be centered AND scollable simultaneously https://github.com/mui-org/material-ui/issues/10235 A simple workaround is to toggle the props on the fly based on screen width (available with withWidth HOC; more on that in the vid!)
For cross-browser CSS normalizations à la normalize.css, look no further than CssBaseline https://material-ui-next.com/style/css-baseline/
See you next time!