DEV Community

Cover image for CJS Cascading JavaScript Style

CJS Cascading JavaScript Style

Josh Kulp on April 18, 2019

CSS in JSX I have been working on some new React projects and the way that the CSS works in JavaScript seemed odd and simple to me at th...
Collapse
 
jaffparker profile image
Jaff Parker

Cool concept. You might just wanna look out for mutating the styles object. In the end when you're passing styles.Item it'll look like this:

{
  background: 'red',
  Large: {
    fontSize: 30
  }
}

Which isn't a valid styles object. If you introduce types to your code, you'll get an error.